time = ["XII","I","II","III","IIII","V","VI","VII","VIII","IX","X","XI"] s1,T = input().split() T = int(T) print(time[(time.index(s1) + T) % 12])