#include<bits/stdc++.h>
using namespace std;
int main(){
int x;
char c;
cin>>x>>c;
if (c=='y'&&x<=1000)
cout<<13;
else if (c=='y'&&x>1000)
cout<<13+(x-1000)/5004+4;
else if (c=='n'&&x<=1000)
cout<<8;
else if (c=='n'&&x>1000)
cout<<8+(x-1000)/5004+4;
return 0;
}