//这道题也很简单,其实zoj中简单的也有不少
//题目:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=365
#include<iostream> #include<string> using namespace std; string s1, s2; int main() { double m, sum; char c; bool flag=1; while (flag) { sum = 0; while (cin >> s1&&s1 != "0") { if (s1 == "#") { return 0; } cin >> s2 >> m >> c; if (c == 'F')sum += (2 * m); else if (c == 'B')sum += (1.5*m); else if (c == 'Y'&&m > 500)sum += m; else sum += 500; } cout << sum << endl; } return 0; }