A company manufactures and sells two types of products, A and B. The company's revenue from selling product A is given by the expression 5x - 2, and the revenue from selling product B is given by the expression 3x + 4. The total revenue from both products is $87. Find the value of x.