#include<iostream >
using namespace std;

class Wallet {
public:
     double balance = 0;
     
     void add(double amount) {
         balance +=amount;
    }
     
     void pay(double amount) {
         balance -=amount;
    }
     
     double getBalance() {
         return balance;
    }
};

int main() {
    int t;
    cin >> t;
    
    Wallet bitcoin, credit, paypal;
    
    string walletType, transactionType;
    double amount;
    
    for(int i = 0; i < t; i++) {
        cin >> walletType >> transactiontype >> amount;
        
        if(walletType == "BitcoinWallet") {
            if(transactiontype == "add")
               bitcoin.add(amount);
            else if(transactionType == "pay")
            bitcoin.pay(amount);
        }
        else if(walletType == "CreditCardWallet") {
            if(transactionType == "add")
               credit.add(amount);
            else if(transactionType == "pay")
                credit.pay(amount);
        }
        else if(wallettype == "PayPalWallet")
{
            if(transactionType == "add")
                 paypal.add(amount);
            else if(transactionType == "pay")
                 paypal.pay(amount);
        }
    }
    
    cout << bitcoin.getBalance() << endl;
    cout << credit.getBalance () << endl;
    cout << paypal.getBalance () << endl;
    
    return 0;
}