Lemonade Change
Given a queue of customers paying with $5, $10, or $20 bills, determine if you can provide correct change to everyone.
Input format
The first line contains N. The second line contains N values (each 5, 10, or 20).
Output format
Print true if you can make change for all customers, false otherwise. Each customer pays with the value and needs exact change.
Constraints
- Values fit in a 64-bit signed integer
- Trailing whitespace and a trailing newline are ignored by the judge
Read from stdin, write to stdout. Sample cases below show the exact format.
Sample cases
Example 1
Input
4
5 5 10 20Expected output
trueExample 2
Input
3
5 5 10Expected output
true