#include<iostream> using namespace std; int main() { int a; char b; cin>>a>>b; int c=4*((a-1000)/500+1)+8; if(a>1000&&b=='y') { cout<<c+5; } else if(a>1000&&b=='n') { cout<<c; } else if(b=='y') { cout<<"13"; } else { cout<<"8"; } return 0; }