#include <iostream>
#include <algorithm>
#include <iterator>
#include <vector>
using namespace std;

int main()
{
    vector<string> days = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    string d;
    cin >> d;
    cout << 7 - distance(days.begin(), find(days.begin(), days.end(), d)) << endl;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
//print(fixed << setprecision(10));
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define repk(i,n,k) for(ll i = k; i < (n); i++)
#define all(n) n.begin(), n.end()
#define print(n) cout << n << endl
double PI = acos(-1.0);
int INF = 1e9;
ll LINF = 1e18;
ll MOD = 1e9+7;


int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    ll n;
    cin >> n;
    string s="";
    while(n){
        n--;
        s+=('a'+(n+25/26)%26);
        n/=26;
    }
    reverse(all(s));
    print(s);
    return 0;
}