import java.util.*;

abstract class Wallet {
    protected double balance;

    public Wallet() {
        this.balance = 0.0;
    }

    public void add(double amount) {
        balance += amount;
    }

    public void pay(double amount) {
        balance -= amount;
    }

    public double getBalance() {
        return balance;
    }
}

class BitcoinWallet extends Wallet {}
class CreditCardWallet extends Wallet {}
class PayPalWallet extends Wallet {}

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int t = Integer.parseInt(sc.nextLine().trim());

        Wallet bitcoin = new BitcoinWallet();
        Wallet credit = new CreditCardWallet();
        Wallet paypal = new PayPalWallet();

        boolean invalid = false;

        for (int i = 0; i < t; i++) {
            String[] parts = sc.nextLine().trim().split("\\s+");
            if (parts.length != 3) {
                invalid = true;
                break;
            }

            String walletType = parts[0];
            String transactionType = parts[1];
            double amount;

            try {
                amount = Double.parseDouble(parts[2]);
            } catch (NumberFormatException e) {
                invalid = true;
                break;
            }

            // ❌ Reject negative amounts
            if (amount < 0) {
                System.out.println(-1);
                return;
            }

            Wallet wallet = null;
            switch (walletType) {
                case "BitcoinWallet":
                    wallet = bitcoin;
                    break;
                case "CreditCardWallet":
                    wallet = credit;
                    break;
                case "PayPalWallet":
                    wallet = paypal;
                    break;
                default:
                    invalid = true;
            }

            if (wallet == null) {
                invalid = true;
                break;
            }

            if (transactionType.equals("add")) {
                wallet.add(amount);
            } else if (transactionType.equals("pay")) {
                wallet.pay(amount);
            } else {
                invalid = true;
                break;
            }
        }

        if (invalid) {
            System.out.println("Invalid input");
        } else {
            System.out.printf("%.2f%n", bitcoin.getBalance());
            System.out.printf("%.2f%n", credit.getBalance());
            System.out.printf("%.2f%n", paypal.getBalance());
        }

        sc.close();
    }
}

