Hector gave 4 gumballs to Todd.
He gave twice as many gumballs to Alisha as he had given Todd, which means he gave 2 * 4 = 8 gumballs to Alisha.
He gave x less than four times as many gumballs to Bobby as he had given to Alisha, which means he gave 4 * 8 - x = 32 - x gumballs to Bobby.
The total number of gumballs Hector had purchased is the sum of the gumballs remaining and the gumballs given to Todd, Alisha, and Bobby: 6 + 4 + 8 + (32 - x).
We are given that the total number of gumballs is 45, so we can write: 6 + 4 + 8 + (32 - x) = 45.
Simplifying the left side, we get: 18 + (32 - x) = 45.
Combining like terms, we get: 50 - x = 45.
Solving for x, we get: x = 5.
The value of x is 5.
#### 5
The answer is: 5
Below is a math problem. Provide a detailed, step-by-step solution.

### Problem:
Hector purchased a container of gumballs.  He gave 4 to Todd, then he gave twice as many as he had given Todd to Alisha, and then he gave x less than four times as many to Bobby as he had given to Alisha.  If Hector had 6 gumballs remaining, what is the total number of gumballs that Hector purchased?
If we know the answer to the above question is 45, what is the value of unknown variable x?

### Answer:
