it's called a visa on arrival, and despite the name of it, you can now buy one in advance. If you do that then you pay upfront, obviously. Otherwise you have a desk to buy a visa first, before passport control. But there are no queues anymore, since everyone is buying it upfront by now. It's easiest to buy there on the spot.