#! /usr/bin/env python3 import sys n = int(input()) s = input() c = 0 #################### base = {'hand':150, 'lily':2000, 'factory':30000, 'casino':600000, 'grimoire':10000000} basecookie = {'hand':1, 'lily':10, 'factory':120, 'casino':2000, 'grimoire':25000} b = {'hand':150, 'lily':2000, 'factory':30000, 'casino':600000, 'grimoire':10000000} cookie = {'hand':1, 'lily':0, 'factory':0, 'casino':0, 'grimoire':0} r = {'hand':0, 'lily':1, 'factory':1, 'casino':1, 'grimoire':1} buy = {'hand':1, 'lily':0, 'factory':0, 'casino':0, 'grimoire':0} g = {'hand':12, 'lily':9, 'factory':9, 'casino':9, 'grimoire':15} x = {'hand':1, 'lily':1, 'factory':1, 'casino':1, 'grimoire':1} fever = 0 for i in range(n): if 'F' == ss : fever = 20 tc = c # print(c, d, file=sys.stderr) f=0 cmd = '' if cmd == '' and i >= n - 1 - buy['grimoire']: cmd = 'sell grimoire' if cmd == '': for k in b: if k == 'hand' and c > (base[k] // 10) * (11 ** r[k]) * [1.0, 0.9]['S' == ss] and r[k]<3 and buy[k] > 0: cmd += 'enhclick' c -= (base[k] // 10) * (10 ** r[k]) x[k] += 1 r[k] += 1 break elif c > base[k] * (11 ** r[k]) * [1.0, 0.9]['S' == ss] and r[k]<2 and buy[k] > 0: if i > n-400 : continue cmd += 'reinforce ' + k c -= base[k] * (10 ** r[k]) x[k] += 1 r[k] += 1 break if cmd == '': for k in b: if c > b[k] * [1.0, 0.9]['S' == ss] and buy[k] < g[k]+(buy['grimoire']>=8 and x['grimoire']==2 and k == 'casino')*8: if i > n-400 : continue cmd += 'buy ' + k c -= b[k] b[k] = int(1.2 * b[k]) cookie[k] += basecookie[k] buy[k] += 1 break if cmd == '' : cmd = 'click' f=1 else: # print(i, tc, c, cookie, file=sys.stderr) f=0 for k, v in cookie.items(): if k == 'hand' and f: c += v * x[k] * [1,7][fever > 0] else: c += v * x[k] * [1,7][fever > 0] fever -= 1 print(cmd)#################### input()#################### ss = s[i] print(c, cookie, file=sys.stderr)