#include <bits/stdc++.h>
using namespace std;

const int D[11] = {0, 0, 4, 5, 6, 7, 8, 9, 10};
int T, ans;

int main() {
    scanf("%d", &T);
    while (T--) {
        int m;
        ans = 0;
        scanf("%d", &m);
        while (m--) {
            char opt, ppp;
            scanf("%c%c%c", &ppp, &opt, &ppp);
            if (opt == 'A') {
                int x;
                scanf("%d", &x);
                if (x <= 10)
                    ans += x * 100;
                else
                    ans += x % 10 * 1000;
            } else if (opt == 'B') {
                int n, c;
                scanf("%d%d", &n, &c);
                ans += D[n] * 5 * c * 10;
            } else {
                int n, c;
                scanf("%d%d", &n, &c);
                ans += D[n] * 2 * c;
            }
        }
        printf("%d\n", ans / 100 );
    }
}

1 条评论

  • 1