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