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