#pragma region header
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vs vector<string>
#define vvs vector<vector<string>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
constexpr ll mod = 1e9 + 7;
constexpr ll inf = INT32_MAX / 2;
constexpr ll INF = LLONG_MAX / 2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
signed main() {
    string S;
    cin >> S;
    int size = S.size();
    vector<int> date;
    rep(i, S.size() - 2) {
        string suuji=(S.substr(i, 3));
        int a=stoi(suuji);
        int b = abs(753 - a);
        date.push_back(b);
    }
    sort(date.begin(), date.end());
    cout << abs(date.at(0)) << endl;
}
#include<bits/stdc++.h>
using namespace std;

int main(){
    string s;
    cin >> s;

    bool flg = true;
    int c_cnt = 0;
    for(int i=0; i<s.length(); i++){
        if(i==0){
            if(s.at(i)!= 'A'){
                flg = false; break;
            }  
        }else if(isupper(s.at(i))){
            if(i==1 || i==s.length()-1 || s.at(i) != 'C'){
                flg = false; break;
            }
            c_cnt++;
        }  
    }
    if(c_cnt != 1)
        flg = false;
    
    if(flg) cout << "AC" << endl;
    else cout << "WA" << endl;

    return 0;
}