import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N,*R = read().decode().split() U = 4000 roman_rep = [''] * U for n in range(U): i = n // 1000 roman_rep[n] += ['', 'M', 'MM', 'MMM'][i] i = (n % 1000) // 100 roman_rep[n] += ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM'][i] i = (n % 100) // 10 roman_rep[n] += ['', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC'][i] i = n % 10 roman_rep[n] += ['', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX'][i] sum_R = sum(roman_rep.index(r) for r in R) answer = 'ERROR' if sum_R > 3999 else roman_rep[sum_R] print(answer)