print((function (f, s, t) local a={"I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"} return a[(f(s,a)+tonumber(t))%12] end)(function (s, a) for i=1,#a-1 do if a[i]==s then return i end end return 0 end, io.stdin:read("*l"):match("(%w+)%s(%-?%d+)")))