list16=['I','II','III','IV','V','VI','VII','VIII','IX','X','XI','XII','XIII','XIV','XV','XVI','XVII','XVIII','XIX','XX']
list26=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
up16=str(input())
for k in range(20):
  if(up16==list16[k]):
    print(list26[k])
    break

e9adb37d4f2852995a41da58f92f5bf0dadedec6
<mask token>

<mask token>
for k in range(20):
    if up16 == list16[k]:
        print(list26[k])
        break

list16 = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X', 'XI',
    'XII', 'XIII', 'XIV', 'XV', 'XVI', 'XVII', 'XVIII', 'XIX', 'XX']
list26 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
    ]
up16 = str(input())
for k in range(20):
    if up16 == list16[k]:
        print(list26[k])
        break

list16=['I','II','III','IV','V','VI','VII','VIII','IX','X','XI','XII','XIII','XIV','XV','XVI','XVII','XVIII','XIX','XX']
list26=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
up16=str(input())
for k in range(20):
  if(up16==list16[k]):
    print(list26[k])
    break
