The total cost for three shirts is 3 * $5 = $15.
The total cost for x pairs of jeans is x * $10 = $10x.
The total cost for four hats is 4 * $4 = $16.
The total cost for everything is the sum of the cost for the shirts, jeans, and hats: $15 + $10x + $16.
We are given that the total cost is $51, so we can write: $15 + $10x + $16 = $51.
Simplifying the left side, we get: $31 + $10x = $51.
Subtracting $31 from both sides, we get: $10x = $20.
Dividing both sides by $10, we get: x = 2.
The value of x is 2.
#### 2
The answer is: 2
Below is a math problem. Provide a detailed, step-by-step solution.

### Problem:
In a shop, there is a sale of clothes. Every shirt costs $5, every hat $4, and a pair of jeans $10. How much do you need to pay for three shirts, x pairs of jeans, and four hats?
If we know the answer to the above question is 51, what is the value of unknown variable x?

### Answer:
