/*
#include <stdio.h>
#include <string.h>
int main()
{
int a=0,b,c,i,j,t=0, top=0;
int anw[11]={0}, ab[11]={0};
char in[42]={0}, x[101]={0};
gets(in);
for(i=0;i<strlen(in);i++)//데이터 넣기(성공)
//홀수:Xy 계산값
//짝수:아로마 수 크기
{
if(in[i]=='I')
{
a+=2;
anw[a-1] = (in[i-1]-'0')*1; //숫자로
anw[a] = 1;
printf("%d:%d\n", a-1, anw[a-1]);
printf("%d:%d\n", a, anw[a]);
}
else if(in[i]=='V')
{
a+=2;
anw[a-1] = (in[i-1]-'0')*5;
anw[a] = 2;
printf("%d:%d\n", a-1, anw[a-1]);
printf("%d:%d\n", a, anw[a]);
}
else if(in[i]=='X')
{
a+=2;
anw[a-1] = (in[i-1]-'0')*10;
anw[a] = 3;
printf("%d:%d\n", a-1, anw[a-1]);
printf("%d:%d\n", a, anw[a]);
}
else if(in[i]=='L')
{
a+=2;
anw[a-1] = (in[i-1]-'0')*50;
anw[a] = 4;
printf("%d:%d\n", a-1, anw[a-1]);
printf("%d:%d\n", a, anw[a]);
}
else if(in[i]=='C')
{
a+=2;
anw[a-1] = (in[i-1]-'0')*100;
anw[a] = 5;
printf("%d:%d\n", a-1, anw[a-1]);
printf("%d:%d\n", a, anw[a]);
}
else if(in[i]=='D')
{
a+=2;
anw[a-1] = (in[i-1]-'0')*500;
anw[a] = 6;
printf("%d:%d\n", a-1, anw[a-1]);
printf("%d:%d\n", a, anw[a]);
}
else if(in[i]=='M')
{
a+=2;
anw[a-1] = (in[i-1]-'0')*1000;
anw[a] = 7;
printf("%d:%d\n", a-1, anw[a-1]);
printf("%d:%d\n", a, anw[a]);
}
}
for(i=0;i<a;i+=2)//연산 //- + 순서 에러
{
top++;
t+=2;
if(anw[i] >= anw[i+2])//+ 완료
{
x[top] = '+';
printf("[C]%d=+\n", top);
printf("[+][%d>=%d]%d:%d+%d", anw[i], anw[i+2], i+1, anw[i-1], anw[i+1]);
anw[i+1] = anw[i-1] + anw[i+1];//anw:계산할 순서(아로마 수의 크기)
printf("=%d\n", anw[i+1]);
}
if(anw[i]!=0)
{
if(3<i)
{
if(anw[i] < anw[i+2])//- ERROR
{
x[top] = '-';
printf("[C]%d=-\n", top);
printf("[-][%d<%d]%d:%d-%d", anw[i], anw[i+2],i+1, anw[i-1], anw[i+1]);
anw[i+1] = anw[i-1] - anw[i+1];
ab[top] = anw[i+1];
printf("=%d\n", anw[i+1]);
}
}
}
}
}
*/
#include <stdio.h>
#include <string.h>
int main()
{
char in[101];
int d[101], ca[101]={0}, i,j,a,b,x,y,top=0, I=1, V=5, X=10, L=50, C=100, D=500, M=1000;
int cp=0;
scanf("%s", in);
for(i=0; i<strlen(in); i++) {
if(in[i]=='I') ca[cp++] = 1;
else if(in[i]=='V') ca[cp++] = 5;
else if(in[i]=='X') ca[cp++] = 10;
else if(in[i]=='L') ca[cp++] = 50;
else if(in[i]=='C') ca[cp++] = 100;
else if(in[i]=='D') ca[cp++] = 500;
else if(in[i]=='M') ca[cp++] = 1000;
}
for(i=0; i<cp; i++)
{
if(ca[i])
}
}



