#include<iostream> using namespace std; int main() { int x,l=0; char t; cin>>x>>t; if(x<=1000) l=0; else l=(x-1000)/500; if(l*500!=x-1000) l++; l*=4; if(t='y') l+=5; printf("%d",l+8); }