rt
#include<bits/stdc++.h> using namespace std; int main() { char c; int x,s=0; cin>>x>>c; if(c=='y') s+=5; if(x<=1000) s+=8; else if(x>1000) { if(x-1000<500) s+=12; else s+=ceil((x-1000)/500)*4+8; } cout<<s; return 0; }