Given a list of note codes, sum their lengths in semibreves and print the exact value.
Easy2MathImplementationNo attempts yetTime limit2sMemory limit512 MBListening to music is a good way to take your mind off the monotony of typing out one correct solution after another.
Starting a tune and then having the time run out, cutting the listening short, is very annoying. Picking tunes that fit the time available is far more satisfying.
So you wrote down a way to code a musical score as a plain list of numbers, one per note. Each note is written with a code from the table below, and its length is measured in notes, where one semibreve is 1.
| Code | Name | Length |
|---|---|---|
| 0 | breve | 2 |
| 1 | semibreve | 1 |
| 2 | minim | 1/2 |
| 4 | crotchet | 1/4 |
| 8 | quaver | 1/8 |
| 16 | semiquaver | 1/16 |
Given such a list of numbers, compute the length of the tune.
The first line contains the integer N, the number of values in the tune. (1≤N≤2000)
The second line contains N integers separated by spaces. Each integer is one of the codes in the table above and gives the length of one note.
Print the length of the tune, in notes, on one line.
The length is always a multiple of 1/16, so print the exact value with no rounding. If the value is an integer, print it as an integer with no decimal point. Otherwise print the exact decimal with every trailing 0 removed. For example, print 5 for a length of 5, 4.3125 for 4.3125, and 0.75 for 0.75.