a grocery store ordes 47 bags of onions and 162 bags of potatoes. the onions cost $2 per bag, and the potatoes cost $3 per bag. how much is spent on onions and potatoes?