#K45577. Digital Wallet Balance Calculator

    ID: 27784 Type: Default 1000ms 256MiB

Digital Wallet Balance Calculator

Digital Wallet Balance Calculator

You are given a digital wallet that supports two types of transactions: credit (adds money) and debit (removes money). Your task is to compute the final balance in the wallet after a series of transactions.

The input will consist of the number of transactions followed by each transaction on a new line. Each transaction is represented by a type (either credit or debit) and an integer value. If the final balance is negative, output Insufficient funds; otherwise, output the balance formatted as Balance: $x.xx (with exactly two digits after the decimal point).

For example, if the input is:

4
credit 100
debit 50
debit 20
credit 70

Then the output should be:

Balance: $100.00

inputFormat

The first line of the input contains an integer N representing the number of transactions. Each of the next N lines contains a transaction in the format:

 

Where transaction_type is either credit or debit, and amount is a non-negative integer.

outputFormat

Output a single line. If the final balance after processing all transactions is negative, print "Insufficient funds". Otherwise, print the balance in the format "Balance: $x.xx", with the amount represented with exactly two decimal places.

## sample
4
credit 100
debit 50
debit 20
credit 70
Balance: $100.00