s,n = map(str, input().split()) n =int(n) t = ["I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"]*2 print(t[t.index(s)+n%12])