#include <iostream>
#include<vector>
#include<string>
using namespace std;

int Roma(char a){
switch(a){
	case 'I':return 1;
	case 'V':return 5;
	case 'X':return 10;
	case 'L':return 50;
	case 'C':return 100;
	case 'D':return 500;
	case 'M':return 1000;
}
return 0;
}
int main() {
while(1){
	string a;
	cin>>a;
	if(cin.fail())break;
	int s=0;
	for(int b=0;b<a.length();b++){
		if(a.length()-1==b){
			s+=Roma(a[b]);
		}
		else{
			if(Roma(a[b])<Roma(a[b+1])){
				s+=Roma(a[b+1])-Roma(a[b]);
				b++;
			}
			else s+=Roma(a[b]);
		}
	}
	cout<<s<<endl;
}
}
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

int main() {
  string s;
  cin >> s;
  bool ok = true;
  if (s[0] != 'A') ok = false;
  int cnt = 0;
  for (int i = 1; i < s.size(); i++) {
    if (i >= 2 && i <= s.size() - 2) {
      if (s[i] == 'C') {
        cnt++;
        continue;
      }
    }
    if (!islower(s[i])) {
      ok = false;
    }
  }
  if (cnt != 1) ok = false;
  if (ok) cout << "AC" << endl;
  else cout << "WA" << endl;
  return 0;
}