human
Minimum cost to reach a point N from 0 with two different operations allowed | Function to return minimum cost to reach destination.
Initialize cost to 0.
going backwards until we reach initial position.
if 2 * X jump is better than X + 1.
if X + 1 jump is better.
Driver program"
Solution in Python:

Write me a code to minimum cost to reach a point N from 0 with two different operations allowed and the other steps required?
assistant
#Here is code to minimum cost to reach a point N from 0 with two different operations allowed and the other steps required.
 def minCost ( N , P , Q ) :
	cost = 0
	while ( N > 0 ) :
		if ( N & 1 ) :
			cost += P
			N -= 1
		else :
			temp = N // 2 ;
			if ( temp * P > Q ) :
				cost += Q
			else :
				cost += P * temp
			N //= 2
	return cost
N = 9
P = 5
Q = 1
print ( minCost ( N , P , Q ) )