Just A Minim

Given a list of note codes, sum their lengths in semibreves and print the exact value.

Easy2MathImplementationNo attempts yetTime limit2sMemory limit512 MB

Problem

Listening 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 11.

CodeNameLength
0breve22
1semibreve11
2minim1/21/2
4crotchet1/41/4
8quaver1/81/8
16semiquaver1/161/16

Given such a list of numbers, compute the length of the tune.

Input

The first line contains the integer NN, the number of values in the tune. (1N20001 \le N \le 2000)

The second line contains NN integers separated by spaces. Each integer is one of the codes in the table above and gives the length of one note.

Output

Print the length of the tune, in notes, on one line.

The length is always a multiple of 1/161/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 00 removed. For example, print 5 for a length of 55, 4.3125 for 4.31254.3125, and 0.75 for 0.750.75.