eolymp
bolt
Try our new interface for solving problems
Problems

Phibonachies’ Numbers

Phibonachies’ Numbers

What can most Phibonachies number be made if you have a set of numbers \textbf{С_0}, \textbf{С_1}, \textbf{С_2} ... \textbf{С_9}, where \textbf{С_0} is a quantity of numbers \textbf{0}, \textbf{С_1} is a quantity of numbers \textbf{1}, ... \textbf{С_9} is a quantity of numbers \textbf{9}. \InputFile There are \textbf{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 \textbf{100}. \OutputFile There is one number. It is a number of Phibonachies’ number, or \textbf{-1}, if the number is notige\textbf{.}
Time limit 1 second
Memory limit 64 MiB
Input example #1
1 2 3 0 0 0 0 0 0 0
Output example #1
8