#include<bits/stdc++.h> using namespace std; int main(){ int n,ans=8; char y; cin>>n>>y; if(n>1000) ans+=((n-1000-1)/500+1)*4; if(y=='y') ans+=5; cout<<ans; return 0; }