#include<iostream>
using namespace std;

int main() {
    int t;
    cin<<t;
    
    double b=0,c=0,p=0;
    
    while(t--){
        sting w,tr;
        double amt;
        cin >> w >> tr >> amt;
        
        if(amt<0){
            cout<<"Invalid input";
            return 0;
        }
        if(w =="BitcoinWallet"){
            if(tr == "add" )b += amt;
            else if(tr == "pay")b -= amt;
            else{cout << "Invalid input";return 0;)
        }
         else if(w =="CreditCardWallet"){
            if(tr == "add" )c += amt;
            else if(tr == "pay")c -= amt;
            else{cout << "Invalid input";return 0;)
        }
         else if(w =="PayPalWallet"){
            if(tr == "add" )p += amt;
            else if(tr == "pay")p -= amt;
            else{cout << "Invalid input";return 0;)
        }
        else{
            cout<< "Invalid input"
            return 0;
        }
        
    }
    cout<< b << endl;
    cout<< c << endl;
    cout<< p;
}