If the average of x and 3x is 12, what is the value of x?