from random import randint

money = int(input())
iteration = 0
bet = 1;

while money>0 and iteration <= 100000 :
	x = randint(-1, 36)
	iteration = iteration + 1
	if x<=0 or (x%2==0) :
		money = money - bet
		bet = min(bet*2, money)
	else :
		money = money + bet
		bet = 1
	if iteration%100==0 :
		print(iteration, money)

if money==0 :
	print("Bankrupt after %d iterations." %(iteration) )
else :
	print("Success after %d iterations with result: %d" %(iteration, money) )
