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