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