LearnPy Hub
← Arena
IntermediateRating 1100

Lemonade Stand

Lemonade costs 5 Tk; customers pay with 5, 10 or 20 Tk notes in order and you start with no change. Print YES if you can give everyone correct change.

Input

n, then n notes.

Output

YES or NO.

Sample 1

Input
5
5 5 5 10 20
Output
YES

Sample 2

Input
5
5 5 10 10 20
Output
NO
solution.py
Output appears here
Lemonade Stand · Python Arena problem · LearnPy Hub