#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int w, p = 8;
char c;
cin >> w >> c;
if (w > 1000)
p += ceil((w - 1000) / 500.0) * 4;
if (c == 'y') p += 5;
cout << p;
return 0;
}
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int w, p = 8;
char c;
cin >> w >> c;
if (w > 1000)
p += ceil((w - 1000) / 500.0) * 4;
if (c == 'y') p += 5;
cout << p;
return 0;
}