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