#include<bits/stdc++.h> using namespace std; int x,s=8; char c; int main(){ scanf("%d%c",&x,&c); if(x>1000){ x-=1000,s+=(x/500)*4; if(x%500!=0) s+=4; } if(c=='y') s+=5; printf("%d",s); return 0; }