using System; namespace ATCoder { class Program { static void Main(string[] args) { string s = Console.ReadLine(); string roma = s.Split(' ')[0]; int t = int.Parse(s.Split(' ')[1]); int current = 0; foreach (char c in roma) { if (c == 'X') { current += 10; } else if(c == 'V') { current += 5; } else if(c == 'I') { current += 1; } } while (t < 0) { t += 12; } int time; time = current + t; time = time%12; string p = ""; for (;time>= 10; time -=10) { p += 'X'; } for (; time >= 5; time -=5) { p += 'V'; } for (; time > 0 ; time--) { p += 'I'; } Console.WriteLine(p); Console.ReadLine(); } } }