#include using namespace std; void maimun() { ios::sync_with_stdio(false); cin.tie(0); } int main() { #ifdef ONLINE_JUDGE freopen("gptJ.in", "r", stdin); freopen("gptJ.out", "w", stdout); #endif maimun(); int n; cin >> n; int a[n]; string words[27] = { "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen","Seventeen", "Eighteen", "Nineteen", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety" }; int values[27] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 30, 40, 50, 60, 70, 80, 90 }; for (int i = 0; i < n; i++) { int total = 0, temp = 0; string s; while (cin >> s && s != "END") { if (s == "Hundred") { temp *= 100; } else { for (int j = 0; j < 27; j++) { if (s == words[j]) { temp += values[j]; break; } } } } total += temp; a[i] = total; } for(int i = 0; i