#K59872. Final Account Balances
Final Account Balances
Final Account Balances
You are given a number of accounts and a set of transactions for each account. For every account, the first number indicates how many transactions follow. Then, exactly that many transaction amounts are provided. Your task is to compute the final balance for each account. If the final balance, \(B\), satisfies \(B < 0\), output the balance followed by "Overdraft"; otherwise, output the balance followed by "OK".
Input Format: The input is read from standard input (stdin). The first line contains a single integer \(n\) indicating the number of accounts. Each of the next \(n\) lines describes an account. Every line begins with an integer \(k\) denoting the number of transactions, followed by \(k\) integers representing the amounts of each transaction.
Output Format: For each account, output on a new line the final balance and its status. The status is "Overdraft" if the balance is negative and "OK" otherwise.
inputFormat
The input is provided via stdin. The first line contains an integer \(n\), the number of accounts. The following \(n\) lines each represent an account:
- The first number on each line is \(k\), which is the count of transactions for that account.
- This is followed by \(k\) integers, each representing a transaction amount.
Note: If \(k = 0\), it indicates that there are no transactions and the balance is 0.
outputFormat
Output is printed via stdout. For each account, output a line with the final balance followed by a space and then the status. If the balance is negative (i.e. \(B < 0\)), print "Overdraft"; otherwise, print "OK".
## sample3
5 100 -50 20 30 -10
2 -10 -20
4 50 50 -60 -40
90 OK
-30 Overdraft
0 OK
</p>