eolymp
bolt
Try our new interface for solving problems
Problems

Phibonachies’ Numbers

Phibonachies’ Numbers

Time limit 1 second
Memory limit 64 MiB

What can most Phibonachies number be made if you have a set of numbers С_0, С_1, С_2 ... С_9, where С_0 is a quantity of numbers 0, С_1 is a quantity of numbers 1, ... С_9 is a quantity of numbers 9.

Input data

There are 10 integers in the one line; each of them follows to quantity of the proper numbers in a set. All of entrance information do not exceed 100.

Output data

There is one number. It is a number of Phibonachies’ number, or -1, if the number is notige.

Examples

Input example #1
1 2 3 0 0 0 0 0 0 0
Output example #1
8