SDE Path

Lemonade Change

Easy

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 20
Expected output
true
Example 2
Input
3
5 5 10
Expected output
true