#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using P=pair<string,int>;

int main() {
    map<string,int> day{P("SUN",7),P("MON",6),P("TUE",5),P("WED",4),P("THU",3),P("FRI",2),P("SAT",1)};
    string S;cin>>S;
    cout<<day[S]<<endl;
}
#include <bits/stdc++.h>
#include <cstdlib>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;

int main(){
  vector<string> D = {"SUN","MON","TUE","WED","THU","FRI","SAT"}; 
  string S;
  cin >> S;
  int ans=0;
  rep(i,7){
    if(D[i]==S) ans = 7-i;
  }
  cout << ans << endl;
  return 0;
}
