Rikka was walking around the school building curiously until a strange room with a door number of 404 caught her eyes.
It seemed like a computer room --- there were dozens of computers lying orderly, but papers, pens, and whiteboards everywhere built up a nervous atmosphere. Suddenly, Rikka found some mysterious codes displayed on a computer which seemed to have nothing different from others --- is this a message from inner world?
Excited Rikka started her exploration. The message was generated by a program named for_patterns_in_mobius which outputted a string s of length 109, containing the value of ∣μ(x)∣ for x=1,2,…,109 in order.
Suddenly, Rikka heard footsteps outside. She quickly took a screenshot and left. The screenshot recorded a string t of length 200, perhaps a substring of s. Now Rikka wonders if it is really a substring of s, and if so, where it first appears in s.
Could you help her to decipher the codes?
There are 10 lines in total. Each line contains 20 characters, each of which is either "0" or "1". t is the concatenation of them --- the result of concatenating them in order.
Output a single integer in the only line. If t is a substring of s, output the first position it appears in s, that is, the minimum positive integer p such that all the digits ∣μ(p+i)∣ for i=0,1,…,199 form the string t. Otherwise output −1.
The definition of μ() is as follows:
For any positive integer x, let x=∏_i=1kp_ic_i be the regular factorization of x, where p_i is a unique prime, c_i is a positive integer, and if x=1 then k=0. Consequently, μ(x) is defined as μ(x)=⎩⎨⎧0 (−1)k ∃c_i>1,otherwise