#include //#include #include #include using namespace std; int m, d, c, l, x, v, i, ix, xc; //char s[10001]; string s; int main() { int sl; // while (gets(s) && (sl = strlen(s)) > 0) while (getline(cin, s) && (sl = s.length()) > 0) { m = d = c = l = x = v = i = xc = ix = 0; int j; for (j=0; j 0) { xc++; l = x = v = i = ix = 0; } if (xc == 0) { if (k == 'l' && l == 0) { l++; x = v = i = ix = 0; } if (k == 'x' && x < 3) { x++; v = i = 0; } if (k == 'x' && x == 3 && i > 0) { ix++; v = i = 0; } } if (k == 'x' && xc == 1 && i > 0) { ix++; v = i = 0; } if (ix == 0) { if (k == 'v' && v == 0) { v++; i = 0; } if (k == 'i' && i < 3) { i++; } } } printf ("%d\n", m*1000 + d*500 + c*100 + l*50 + x*10 + v*5 + i + ix*9 + xc*90); } return 0; }