#include <bits/stdc++.h>
using namespace std;
using ll         = long long;
constexpr ll MOD = 1000000007;
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REP2(i, x, n) for (ll i = x; i < (n); i++)
#define PR(x) cout << (x) << "\n"
#define PS(x) cout << (x) << " "
const long long INF = numeric_limits<long long>::max();
int main() {
    ll N;
    cin >> N;
    ll sum = 0;
    for (ll i = 1; i <= N; ++i) {
        if (i % 3 == 0) continue;
        if (i % 5 == 0) continue;
        sum += i;
    }
    PR(sum);
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

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