minimun finding in a mathematization problem

let's have a city X in a country A where the gasoline costs less than in the neibour country B.

a car starts wih the full tank from X and goes to the frontier towards B.

one way trip.

the price of the fuel increases linearly from X to the frontier, and the tank is full enough to go to the frontier without any stop (the car could not stop till the frontier and at the frontier in B the car makes a full refill at the price of the country B).

also the consumption rate of the fuel is constant.

The maximum amount of gas the tank can hold is precisely the amount necessary to get from X to B

what is the best stategy for the car to spend least money? i.e. how many times and where does it have to stop to minimize the cost of the trip?

let's assume the trip distance=1.

let's assume that the driver makes N stops before reaching the border, then I have found that they must be equidistsant from each other, distance between each one= 1/(n+1 ). and I have that the cost decreases as N increases.

so mathematically speaking, the driver should stop infinitely, which is impossible...

has anyone a different solution?(Wait)