56
 1
 46
 63478
 7578
 56056
 78
 66873
 8149
 35708
 81207
 41385
 37317
 74424
 67817
 684
 15
 96992
 38798
 19715
 627
 39509
 45899
 31893
 1515
 33
 95298
 27443
 60879
 99
 34378
 57113
 36655
 63359
 873
 67341
 100000
 42863
 35
 250
 573
 23
 871
 15748
 92763
 9564
 42602
 38
 42237
 70878
 93764
 303

-1
 -1
 4
 -1
 3
 -1
 4
 2
 2
 -1
 6
 15
 -1
 21
 73
 -1
 2
 -1
 76
 -1
 2
 -1
 -1
 3
 2
 2
 4
 2
 2
 2
 -1
 2
 -1
 34
 18
 2
 -1
 -1
 -1
 5
 3
 -1
 -1
 8
 22
 3
 17
 -1
 18
 -1
 -1
 2

#!/usr/bin/python2
#-*- coding: utf-8 -*-

import sys,math

#ret = raw_input()
#ret = ret.split(' ')
#text = raw_input().rstrip()
#znak = sys.stdin.read(1) 
#pole=[[]*n for r in xrange(n)]

N = int(raw_input().rstrip())

pozice = [0,0,0,1]

for i in range(4,10000) : 
    n = 2
    nalezene = 1000000
    while n <= i/n :
        if (i*2 % n == 0) :
            if (i*2/n - n + 1) % 2 == 0 :
                k = (i*2/n - n + 1) / 2


                vyhravajici = False
                for a in range(n) :
                    if pozice[k+a] == 1 :
                        vyhravajici = True
                        break
                if not vyhravajici :
                    if nalezene > n : nalezene = n
                    break
        n += 1
    pozice.append(1 if nalezene < 1000000 else 0)

s = "".join(map(str,pozice))


pozice = "01001101010100000001111101010000001001101011000000000101011001010100000001010101000000100010001000000001000001001001000001000001001000000011000001011101000000001000010001110101010111010100001000000101000010000011001000101000010101110101000111000101001000000000000001010101001001000001000000000001000000000000010101010000000001000001000001000001011101000000000001000001001001100011000001000001000000100010000001011101000000100010001001101011001000000101011101001001010000000101000001010101000001010101000001010101000001010101000001011101010010011101001101001001000010000000100001000001011001011101011101000010001001111011000001010101001001011101001001010101000000100010000001010101010000011100000101011101000000100011000001000001000000010101001101010000000000100010001000100011001001100010001000100011001000100010000001001001000000100010000001011101000000110010000001010100010100000000010100000101000000100010000001010101000000100010000001011101000001100010001000000101011100000010001000100000010101011101001101001001010101011101001001011101000001010101000001011101011101000000010101010000000001010101011101010101000001010101010101011101010000010101000000000011001001100001000001000000001000100011001001011101011001010100000001000001000000100010000101010111000001101010101001010101000000100010000001001001000000010101001101001001010010011000100101001001001001010100000001000001000000100010001001010101000000100010000001011101000000100010000001010101011001011101001101000001010000011101010101011101001001100000000001011001001000100011001001011101000000100011000001011101000000000001000101000011000001010101101001011101010101010101001001011101011101010101010101001011001000100010000001011101001000110010100001011101000000100010001001000001010000001000010101011111000001011101100001010101010000010100000000001001000001100010001000100010001100100010000001010101010101000000000001010101010100000010000001010101000000100010000001010101010100000000000101010000000000100010000001011101000010100010001001101111001001101010001000110000000001110001001001100010001000010101110101000001000001000001000001000001000011010101011101011001011101010101000000000011001000000001010101010101001001010101001001010101000000000000000001000001010101010000001000100010000001010101001001000001010100000101010101010101000000100010000001000001000000100010010001010101000011011101000001011101000001010000010101000001010000000101000000000010001001101011001000100010000101000000001000100001011101011100000101010101000000100010000000010101001001100010000000000001000000100011001001010111000100000000000001000001010000010101000000000010001000100011001001101011001001101011000001010101011101011001001001011101000001011101001001100011001010000101001001000001000001100011000001000001000000010101001101001001010101011101000001011111000101011101010101011101001001000101000001000001000000100010000001010101000000100010001001000001000000000101010101010101000001010101000001010101001001000101000001000001000000100000010101000001000000100010000001011101000000100010000001000001000000000011001001011101010101011101000001010101010100000000000001001001001001100010001001010101000000101010000001010000001000100011001001101000000001010101011101010101000000000101000001000001000001000001000001000101000000100010001000000000010100001000010101010000000001000001000001100010001000000101011101001001010101010101000001010101001001100010001000100011001000100010000001010101010101000000001001101011000001000001000001000001000000000001011101011101000001011101000001010101000000100010000001001001000001000010001000100000010101000000001001101011001000100010000001000001001000010100000101010101000000100010001000000101011101000000011101011001000001010101001001100010001001100010000000010101000000100010001001101011001000100011001001111101010101011100000001001001000001010101000001010101001001010101001001011101001001011101001001011101000001010101000001011101000000011100000101011101000000100010001000000001000001000001000001000100001000110011001001100000000101000000010000000101001001100110001000010000000000000011001001100000000001000000000001010101000000100010000001000001000000000001011101000010000001000001000000100001011101010100000101000001010101010001011101010000001000100011000001000011000000100010000001010101000000100010000001010101010100000000010101011001001001010101000001101011001000000101111101010101000000100010001000100010001000100010001000100011001001100011001001100001000001000001001001100001001001010001100001000001000001100010000001010101000011011101000001011101011101000010001000100011001000100010000001011101000000100010001000100010001000100010000001000001000000010110000101011101001000101010001000110011001001100101000001000001001010100011001101011101001001011101011001011101101001101011001001000101000000000011001001101001010101000000000001000001011001010101000000000011001000101010000001011101000000100010001001011101101001100010001001101001010101010101001001000001010010001000100101001011010100011100000101011101000000100010000001011101000000010101000101001001000000000000000001010101000001011101010101011101000001011101000001010101011101010101011101001011001000100011001001000001000001101011000001010101000000100010001000000001010101010101001001010000001001101011000001010101010000010100000101001001000000100011001001000101001000010001010101010101000001010101000001000001000001000001000001000001000001100010001000000001011101000000000001000100001001010101001001100010000001000001000001000001011001010101001001000001000000100010001000100000000001000000000001000001011000010000000001000000000001010101000001010101000001000001000001010101000000000010000001000001000000010100000001000001000000000000000000000010001000100010010000000001000000100110000001011101000001000000000001001101000011010101000001110101011100001000010101010000000001000001000000000101010000010100000001000001000000100011001001000101000001000001000001010000001000100010000001000001000000100011001001010101000000100011001001000111000001000000110101011001000001000001000001011101011101010010101001101011001101100010000001011101010000010101001101001001010010011100100001001001010000001101001001010101000000100010000001010101011001011101001101001001000010010100101101001001011001011100000101011101010001111101000001011101011101000000010101011011001000100011001001011101000000100010000001010100000001100010001001001001010100000001011101010000000001001011100001000101101101010000000000010001000011000101001000000001000001000000000001010001001001101011001001011101011000011101001101010101000000100011001001000001000001000001000001000000001000100011001001000001010001000100000000010101000000110010001001001001010100000011001001011101010101011100001001011001100001011110000101011101001001011101001001011101001000011100001001011101001001010101001001010101000001010101001001001001000000010101010101011101001001100000000001010001000001010101000000000101010100001010001001100010001000100010001001000001000001010001001001100010000000000001000000000101000000000010001000100011001000100010000001010101000000100010001001010101000000100010001001101011011000100001010111010101001001011101000001011101011001001001000100000001000000100010001000101011001001100010000001011101000000100010000001000001001101010011101001011111010101010100000101001001011101010000001001100010000001000001000001001101010100000000010101011001001001100010000001010101011001011101001101001001010010010100001101000001011101010000001001101111001000100011001001010101000001101011000001010101001001100010101001111101010110000101011101011101001001010101000000100011001000000001010001011101000000110011001001011001000000100010000001010101000000100010001001000001000001000001001001100010000001010101001001011101011101000000000001000001001000100010000001010101000000101010001001010101001000100010001001100000000001010001001001011101000001011101011101010101000000100011000001000001000000100011001001000101010100000000010101010101000001000001000001010101001001101011001001011101001001001001001001101011001000100011001001100000000001000001000001000001000001000000001000100011001001100010000001000001000000100011001001010101000000100010001001011101011001010100000001000001000001000001000000000011001001100000000001010001001001000001000001001101001101011101011000011101001001000001000000000001000000000000010101011001001000110010100001011101000000100010000001011101000000101010001001100010001000000101010101011101000001010101000001010101000001011101001001010101010101010001001001101001011101011101011101000101000000000010000001011101010000110101001111010101001000100010000001010101011001000000000000001001000010010101101101001001000000000010000101010101001001100000010101010101010100000001011101011001001001000001000000000000000001000001001001000000000001010101000001000001000001000101000001010101000010100011000001101101010000000001001101011101000001011101001001011101011101000000000001000000000001000001001001011101011101011000010101011101001001101010010001100001000010010101001101001001010010011100100101001001011001000100000000000101000000110010000001010000010101001001010100000101000001010101000000010000000001000011001101001001010100001100000000000001010010010100100001001001000011000000100001011001011001011101001001010100000000100010000001000001010000010101001101001001010001011101000101010101001001001001000001011101000000010100001101001001011101010101000000000011000001000001010101010101011100000010010001011101000001001001000001011101000100100000001001000000000001010101001001001001000000000101010000001101000000010100000100000011001000100010001001010101010100001100000001001001000001010000000001000001001001011101001001011101001001011101001001011101001001011101001001011101001000011100001001001001001001011100001011011101001001010101000001011101000001011101000001011101000001011101011001110101000000000001000001001000000000010101001101010101000000100010000001010101010000010100000001000001000001010101000001010101010001011101011101001011001001101011001001011101000001010101001001010101000001101011101000100011001001010101000001010101000010000001000000000011001001011101010101011101000001011101000001011101010101011101011101000010001001101011000001010101010101010101000001011101001001101011000001010101000000100011001001100011001001100011101001100010001000100011001001010101000010000001000001000011001001100011001001100000000001010100000101000001010101010101000001011101001001010101000000000101010100000001011101011101000001010101000001001001011001000100000001000001000001010001001001011101000001010101000001010101000001000101000001000001000001010001011101001001010101011101000001011101011101010101010101001101010100001101011101011101011101011101001001010101000001000000001000100000011101000101010101011101000001011101010101010101001001100010000001000001000000100010001000000101110101010000010101011001001001100010001001101001010101010101001101010101000000100010001000100001011111011101010101010101000001010101000001001001000000010100000101011101000000100010001000000001000000001001011101111101000001011101000001011101000000011100000001001001001001011101001001011101000001011101000001011101000001010000010101011101001001011101001001010101000000100000010101000001001000100010001001000001001000010101011101010101000001000001000001010101011101010000001000000001000001010001011101010101000000100001000001000001001001011101001101010000000001010101001001001101011001011101001001010101000000000010000001011101011001011100000101001001000000011101010101011111001001100010001000110000000000011101001001001101010101011111000101011111001001100010101000110010001000100011101001010101000000100010001000100011001001011000010101011101001001001101011101010101000000100011000001010101010101010101000000000010001000100011001001010101000001000000001000100011001001100010000001000001000000100011001001100010001000000001000000000101010101010101000001011101000000010101000001010101000001100000000001000001000000100010001000100010001000000001010101010101000000100010000001011101010101000000001001100010001000000101011101010101000000100010001000100001011101010100000001000001000001100010001000100001011101011101010101011101000001011101000001011101101001111011001001100010001000100011000001010101000001010101000001011101011011011101011101000010001001101011001001101011001001100010000001011101001000110010001000100011000001000001000000000101011101011001011101011101000001010101000001010101010000011101001101000001000001000000001000100010010101011101011101100010001001101011000001010101011001010100000001000001000001100010000001010101011001011101001101010101000001000001000001000001000000010101001101001001010101011101000001000001010101010101000000000010001000010101011101001001010000010100000101011101001000100010001000000001000000000001011101001001000001011101000001011101010000010100000101011101000000100011011001111101001001011101000001001000000000000001000000000001011001001001000001011000000001011100000001011101000001011100000101001001011001010101000000000001000000000010000001011101101001110010001001101111001000100001011101010000000001011101001001011101000001011101011101011001111001010110000001000001000000100010001000100010001000100011000001011101010000010100000001010101000001011101000001011101010100000000010101000000001000100010001000010101000000011100000001000001000001100011000001000001000110010111011101011101001001101011000001010101011001011101001101001001011001010101000000000011001001100010001000100001011101011101001101001001010101010101000001000001000001001001000000000101001001010000110001001111000111001001011001110101010111001101011101011011001001010101100001111011001000000101010101000001011000011100000001011101000001011101001001010101010001011101001101001001011001011101000101011101000000100010000001010101011001011101001101001001010011011101110101101001011011010100100101000000000000010101000001010101000001010101010101011101000001010101010100000101010101010101011101011101010101011101000001011101000000010100000001000001000001010101000001011101010101011101001101001011011111010100100101001001011001011101001101010101000000100010000001000001011001010100000101010101001001101011001001010101010001011101001101010101001001101011001001010101011001011101001101000001000001101011000000010101000000011101001101010000000000100011001001011101011001011101001101010101000000100010000001011101010000010100000101010101001001011101000001011101011101000000000000000000001000100010000001010101010000010100000101001001010101010000001000100100001001010101001101000001010010011100100001001001000000010100000001011101000001011101000001011101011101000000000001000001000001000001000000001101010100100110000011010101000010101110011001010101001001100010000001011101000000100011101001011101011000110010001001011101001101011101001001001101010100000000010101011101000001001001000001001001000001010101000001011101001001011101101001010111001101011101001001011101001001010101001001011101000000010100000001001001000000010101010101011101001001100010001000100001010101011111001101001101010101011101001001010101001001111101001001001101010110100001010111011101001001111011101001011101000000100010000001110101001011100010001000100010001000000101011101011101000001011101000001011101000001010101001001010101000001101011000001010101011011011101011101000010001000100010000001010101011001011101001101010101000001100010000001000001000100010111001101110101000001101011000001010101011001010100000001000001000001100010000001010101011001011101000101001001000000001000000001010101000001010101000001011101000001010101000001010101011101010101010001001011001000000101001001000011010100001000010101110101001001100010001001001101110100000011001001100000000001010101001101001001011011010100100001000001000000011101011101000010001000000001001001000001011001010100100001001001000000000101001001010101000000100010000001010111001101101010010001100001000010100111001001010101000000000000000001010101000000100010001000000001010001000001000001000010001000100010000001010101011000010101001101011101000000100010001000100011001101100010000001010101110000011101010101010101000001010101010101010101000001001001000000000101010100000010001001101010001000100011001001011101001000110010001000100011000001100000000001000000000000010100000001010101000000011101000000001101011001000001010101011001000001100011001001010101000001101011000000010101001001100010001001001101010100000011001001010101010101010100000101000001011000010101000000001011000001000001000001010101000000100110001001011101001001100010001001101001010101010101001101000001011000011101110101011101001001100000000001000001000001000001000000100010001000101010000001000001001000100011000001001001001000010100000101010101000001011101000001011101011101010000000001000001001001100010000001010101000000100010000001011101000000100010000001010101000000101010010001110101000010100110001001010101011101011001001001011101010101110101000001000001000010001000100001000001001000010101001001011101000001010101000001001001000000011101010101011101001001000101000001000001000000010101101101011101000001011101000001111101000011010101001001010101010000010101001101000001000000100010000001010101011001010100000101011101000001010101001001011101011001011101000101010101000001100010000101011101010000010101001101001001001010010000100001000011011101011101000000000011001001000001000001000001001000100110000011010101000000100010001001000001000000000101010101010101000001000001000001010100000001010101000000011101000001010101001000000001000000000010001000100000001001010001000001000000000001010101001001100010001000100111001001010001100000110010000001011101000000100010001001100010001000010101011101001001010000010101010001111101000001011101000001011101000001011100000001001001010000011101001101010101000000100010000001010101011001011101001101110101010000100011000001000000000000010101001101000001010101011001001000100101011101010101000000000010001000001101011101011101000001011101001001011101011101010101010101010101010101010101011101011101010101011101000001011111000001010101000001011101000001011101001001011101100001011110000101001001010101110001001010100111001001110001100001000001000001000001000001101101011101000101010101010101000000100011001001011101000001000001000001011101001001100010000001000001000001010001011101110001000011000101001001010101011001010100000101001001010010110101001111000101001001000000001000100011001001100010000001000001000000010101001101011001110101011111000001011101000001011101000001011101001001011101010101001001011001011101000101010101000000100010001000010001000000000001011101010000011000100011000001000001100001010001000001000000000001010000000001010101010111011101001001011101000001011101010101001001011101011001001001100010001000110011100001010101010100000000000000000001001001100011000001010001000000100010000001001001001001100010001000100000001001010101011101000010000001000001000000000001011001010100000001000001000000100011001001000101000001000001000001010000001000100010000001000001000000100011001001010101000011000100001000100001011101010101010100001010001000000001000001000001011001010100000001000001000001000001000001000101000000000101011101011101000001011101000001000001000000010100000001000001001001010101000001011101000001011101010101011101001001000101000001000001000001010101001001001001010101011101010101011101011101010101000000000001000001010101011101011101010101011101000001011101011101010000001000100000000001010101011001000010001001101011000001010101011001011100010101111101000000100010000001010101001001011001001001000001000000000000000101001001010000010101001101010101000000100010001000100011001001000101000001001001010000010101001101001001010000001001000100011000000001100010000001011111000100011101001001010101000000001101011001001001011101010000000101010100000000100011001001011101010000011101010101010101001001010101000001011101010000010101001101011101000001010101000001000001011101000000000001000000001001010101000001011101010101011101000001011101011101010100001001000001000000100011001001011101010000011100000101001001011101010000001000100011000001000001000001010101011001011101001101010101000000000010000001011101011001111101001111010101001001101011000001010101011001000000000100001101000000011101000001011101000000010000000001000001000000100010001000100010001000100010000001011101000000101010001001100111001001100111000101010010001001100010100001010001010000010100000001001001000010010100100101001001010100010110000001000001100000110110001000000101010100000000010101011000000001000001000000000101011100010010001000100001011101010100000001000001000000010101010101010101010101011000010101001001011001000100000101011101000000000101011101011101010101011101010101010101000000100111001001000001000000010101001101000001010101010101000001010101011101010101000000000010000001010101011101000001000000000101001001000001000001100011001001000001000000000000010101010101001001011101000001011101000000011100000001001001001001011101001001011100001001010000001001000001001001010101001001001001001000011100001001010101000001001001000001010101000001011101010101001001010000010101101101001001000010010100000000000001010101010101000001011101000000011101000000001101000001011101010101001001011001010100000101011101010000100011000011010101011101011101010101011101001001100010000001100001000000010101001001001001010000011101000000000101010101100001000010000110001000000101011101001001010000011100000101011101001001100010001000010001100001000011011101011101000001011101000001011101000000010100000001001001000001000001000001010101010101001001011100010011101001000111010101001001011001011100000101011101001001011101000001010101010000010100000001000001000000100010000001011101000000100010000001010101000000100011000001010101000000000001010101010101001001011101000001010101000000100110001001011101000001100010001000000001010100001000000001000000000001000000000001011100000101011101010000111101001011001101001000000101001101000000010001011001000001000001001001011101001100010000010101010000000001000001000001100000000001010101011101000001000001000010100001001001010000010101000101011101001000100010000001010101010001011101001101010101000000100010001001010101010000010101001101010101000001101011000001010101010000010100000101010101000001011101000001010101010000010100001101010101000001101011001001011101010000010100000101010101001001111011100001010101001001010101000001010101000000100010000001010101011001011101000101001001000000000000000001010101001001011101000001011101000001011101000001011101011101011101011101000010001000100010000001011101000000100010000001011101001001100010000001000011000100011100010101110101000001011101000001010100000000010100000101001001000010110101101111001101011011011101100101001001011011011100100101001001011011011100101101001001000000011101010101001001001001100000000000000000001000100011001001010111000100000000000001000001011101010000001000000001000001010101011101011101000000001101000001000001010000010100000101011101000001010101001001101011001001011101011101010101000000100010000001011101010000000000000001000001001001111011101001110010001000100010001000100010001000100010001000100010001000000101011101010101000000100010001000100000010101010101101101010101000001101011000001010101011001010100000101001001011101011001001001100000000001000001000001000011001000100010000001011101000000100010000001001101000000100110000001010100001101000000010101000001000001000001000001011101000000100010000001011101001001010101000000100000000001010001001001011101010101011100000101000001010101010000000001000001000001000001000001000101010100000000010101010101000000100010001001010101000000100010000001000001000000100010000001000001000000100010000001000001000001000001000001000001010101000000000001000001010100000010000001010101000000100011001001010101001000000001000001011101000000100010000000000101000000100110000001010000000001010001001001001001000001011101000001011101011001011101101101011001000010000000100001001001011000010100000101010101000000000010000001010101011001011101000101010101000000100010000001001000010000000000010100000101000001101111000001010101001001010000000001000001000001011101000001010101011001011101000101010101000001000001000000000101011001010100000001010101000001010101000001010101011001010100000101010101000001010100000001010101010001011101001101011101001001010101000001010101011001011100000101010101000001010101010101010101001001011101001101011101000001010101001001101001011101011101011101000010000001010101000001010101001001011101001001010101000001011101000001010111011101011100000000000001000001010101000001010101000000010101001101010101000001100010000001010101010000011101000101010101000001011000000001010101000001011100001001011101000001100011001001001001011001000101000101001001001000000001000001000001000000100010001001010101000001000000001000100011001000000101000000000011001000100010000001011101000000100010000001010000000000100010001001001101010100000001011101010000000001011101000000100011001001001101011101001001011001010101000000000011001001100011001001100000000011010101011101011101001001101011001001100010000001011101001001011101011101010000100001000001001000100010000001011101000000100010000001011101000000100010001001100000000001010101010101011101000001011101010101010101001001100010000001000001000010100110001001010101000000101010000001010101000000100010000001000000001001010001001001010101010101011100010101100001011011011101001101010101100001100010001100101010001000100000000001000000001000100011001001011111010100011100010001101001000010010100100101001001001001010100000001010101000000100010000001010101000000000001010101011101000001000001000001010101000000100010000001011101000000100010001000000000000100000000000001001000000001000001000000000100010000000000000100010001001001000000000000000001100001000001000011000000000000000001001001011100000101011101010000010101000001000001001001000101010101001001010101010001001001100010000001011101010101010001001001011101010101011101100001011101000001010101000001010101000001010101000001001001010000011101001101011101000000100011000001000001001000010101001101010101000001011101000001010101011001010100001001010001100001010001001001011101010101011101010101011101001001010101100001000001000000100010000001010101000001011101000001011101010100000000000001000001001001100011001001100001001001010001000001000001000001000001000001100010001000000101010100000110001000000001000001000001011001000100000001000001000000100011001000000101010101000001010101010000001001100010000001000001000000000101011101000001000001000000001000100001011101010101000000000011001100101010010001011101010101000000001001100010001000100011001001011101010101011101010101011101001001101011000001010101001001100010000001011101000000100011001001011101000000100010000001001001000000100010000001011101001001101011001001010101000001101011001001101011001001011101010101001001010000110100000001010001000000101010000000010101000000100010001001100001000001011101111101111101000001011101010111000001000000010100100001001001000010010101001101000001001001010000101001100011001101101010000001000001010000010100001101010001110101011101000001011101000001011101000001010101000001011101000001000001000000011100000101010101000000100010001000000001000000000011001101101000000001000000000001000001011001010100100001000011000100101011001001011101010101011101001001011101100001011111010101011101001001011101001001100010001001100010001000100011001000100010001001100010001000000101011101000010001000000001000001001001011001110101100011001001010000010100000101010101000001101011000001010101011001011101001101011101100001100011001001011101011101011101001001100010001000110011100001000001000000010101001101000001000000000001001000010011101001000101000001000001000000100010000001010101000000100010001001101011001001011101010001101011001010000101011101001001010000011100000101010101000000100010000001000001000001000001001001100011000101001001010000100011001011001101011101000001000000010101001101011101010001100001000000000101011101000101000001000001000001010101001001101011000001000001000001011101000000100010001000100010001000100010001001100000000001000001100001000001000001100011000001000001000011100110001001010101010001010100000001000001000001100010000001010101011001011100000101010101000000100010000001010000010000010100000101010101000001101011000001000001001001001101000001010101000000100010001000100010001001011101001001010101010011011101000101001001011001010000000101000001000001010101000001011101001001010101000001000001000001000001000001011101000000100010000001011101000000100011001001001101011111000001000001100000001000100010000001010101000000000000000000000101001001100010001001001101010100000001011101010000001001100010000001011100000101011100000101010101000000100010001000000001000001000001000001000000001000100010100001010101000000000000000001010101001001011101100001011111011101000010000001000000000001010000001001010101000000000000000001010101000000100010001000000001000000000001011101010101000001011101010000110101000010001100001101001001010000010101000000000011001001100011001001100001000001000001000001000001000001010101001001011101001001100110001001010101001001100010000001001001000000100010001001000001001000000000010101010101001001010101000000101010001000000101011101000001010000011100000001001001000000001101001001011101010101010001001001100010010101011101011101101011001001000000000001000001000000010100000001010101000000100010001000000101011101000101000001000001000001000001000001010101010101010101001011011101011101100010000001011101010100000001011101010000000001000001000001010110000101010000000000000000000001001001000000000100100000000000000010010001001001001001000000000000100000000000000010010000000001001001000000000101101101001001011001011001000001000001001001001001000100000000010000010100000001010000000001000000000100000011001001100000000000000000000001000001010000010000000001000001000001100000000001010101010001011101001101011101001001010101000001010101010000010101010101010101000001011101010101000001000000100010001000100011001100100010001001100011101000110010000001001101000000100010000001010100000000100010000001000000000000100011001001011101001001011101011101001001010000000001011101000010001000100001001001000001000001000001000001000101000010000001011101111001001000100010000001000001000000100010000001010101000001010101001001010101010100000010001001101011001001000101010101011101011000010101001101001001000010000000100001001001010000010100001101000001000001100010000001000001011000010100000001001001000011001001100001001001000000010100000101010101000001011101001001011101011101010000000001000001001000100010000001011101000001000001100001011101000000100010001001001101010000000001000001010001001001100010000001000000001001010100000001000001000001100011001001000001000001000001000001010001011101011001001001011101010000010100000101010101000001101011001000000101001001000000010101001001000001011101001001010101000001101011001001010101001001100010001001101011001000100011001001010101010101011100000101001001011101010101000000100001000001000001000000000101010100001000010101010101000000100010000001000001000001000000000001000001010101011101000001010101010101010101000000000011001000100010000001000001000000100010000001000001000000100010000001010101010000011101011101110101000000100010001000000100000101010101010101010101001001000001000000000001010100000101010101000000000001010101001001011101010000011100001101011101001001100010001001001101010100000000000001010000001001110001100001000110000000000000000000010001001001000001000000000000000000000001011001011001000001000001000001011101011100000010001001101011001000100010000001000001000010010101011101011101001001000101000001000001000001000001000001000001001001100011000001000001000001000001000001001101000001100010001001010101010000011100000001000001001000100011000001011101011001010100001101010101000000100010001000100011001001000101000001011101000000100011001001101011001000100010001001100001000001000001000001000001000000100011001001100010000011000001000001000001000001000001000001000000001000100010000001010101111000011100000101011101001001100010011000100001000001000001000001000000001000100011000001000001010000000100000000000001000000100011001001010111010001011101000101010101001001100010001000000001000000000010001001100010001000100010000001000001001001010001001001010101000001011101000001011101010000011101001101010101000000100011000001000001000000010101001101010101001000110010000001010101011001010100000001000001000001100110001001010101011001011100000101000001000001011101000001010101001001010101100001011111000101011101000001011101001001000101000001000001000000010101001101010111000001011101100001011101000001010101000001010101010101010101011101100011001011001101011101001001001001010100000001011101010000100011001001001101011001001001001101010000000001100011000001010001000000010100000000000001000000000001000000000011001001100000000001000001001001000001000000001101011101001011001000100011001000100010001001010001000001010001001001011101000001011101000000011101010100000010001000100011001000100010000001010101000000100010001001101011001001100010000001011101000000100010000001010101011101011101100001010101011101010100000000000001000000100010001000101011001000100000010101010101000001000001010101011101010100000010001001100010010101011100000101000001010101011101001001011101000000100010000001000001000000100011000001000001000000100010000001010100000000010100000001001001000000010101011101010101000000100010001001101001010101010101001101000001011000010100000101010101001001101010001000000001000000000000011101010101000001011101000001010101000000010100000101010101000000100010001000000001000001000001000000000000001000100000000001000001000000010101001101010101000000100010001000000101010100000000010101011001000001010101001001011101000000100010000001011101000000100010001000100010001000100010000001011101010101011100000101000001010101000000001000100011000001000001001001000101010100000000010000000001000001000001000001000001000000000010001000100000000001000000000001000001011001010101001000000011001000100010000001000001000000100010000001011101000000100010000001010000000000100011001001101011000011000001000001000001000001000011001001101000000001010101001101001001011000011101000001011101000001011101000001011101000001010101000001011101000001010000000001010101011101000000000001000000001000000101011101011101010101011100010001111101000001010101000001011100000001011101000001001001000000011101100111001101011001010100000101011101000000101011001001101011001000100010001001011101100001100010001001100010001000100011001001100000000001001000000001000001011000010100000001100001000000100011001000101011001010100000010101001101000001000001000001010101001000100010000001010101000000100010000001010101000000100010001001010101000000100010000001000001000000100010001000100011001000100010100001000001000000100011001001011101000011011101000001011101011101000000000001000001000001000001001000100011001000001001010100000010001000100010001001100010001000100010000001011101000001010101010101000001011101010000001000100011001000100010000001010101000000100010000000000101001001101011001001011101110101010111000101010101000001001001010101010101001001000101010101001001000001010101001001010101000001001001011101010101001001100010001001001001010100000001001001010000001001001001000001010100000101010101010000011101001001011101001001000101000000000010001000100011001000100010000001011101000000100010001001101011001000100010000001100001000011000101001101000011000000100010000001000001000001000101000000000011001000100010000001010101000000100010001001000101010100000010001001100001000001000001001001100010001000100011001001010101001000110010000001010101001001010101000000100011001001000101001001000001000000100010001001101011001001100010001001101001010101010101001101011101000001010101000001010101000001010101000000000001000001000001000001000001001001100011000011010101011001010100000001000001000001010101000001010101010101010100001000000001001001011101001001011101010000011100000101011101001001110000100001000001000000000000010101010101000001000001000001011101000100000000010101001001000001000001000001100010001000010101011101001001010000011100000001011101000001011101001001011101000001011101000001011101011101010101000000000001000001000011100001000001000001010101001001010101000010100010001000100001011101010000000000000011001000100010001001101011001000100010000001011101001001010101000001001101010100000000000001000000000001000001001001000000001101000000000000000000000001000001010100000100100000000000000010010001001001000001000001000000000000000000010000010101000001001001000000000001000001000001010101011001001000100011001001011101010101000001010100000010001000100010001001000001000000000001011101010101000000100010101000100011001001100010000001000001000011000100001000100010001001100010001000100011001001000101010101011101001001011101001001100000000001000000000001000001010101010000001000100011000001000000000001001001010100000000010101011101001001110010100001010111000000100011001001010101000000100010001000100011001001000101010101000001010000000001000001000011001001100011001001100000000001000000000001010101010101010100001101010101000000100010000001010001000001100011000001000001001000100010000001010101000000000000000001000001011001010101000000000010001000100011001001001001010101011100000001000001000001010101000001010101000001010101000000000001000001000000010101010101010100000010000001010101000000100010000001010101001001101011001001010101011101001000010101010101000000100010000001010100000000100010000001011101000000100011000001000001000001010001001001100010001000100010000001010101011001010100000001000001000001100011000001000001000000010101001101011101001001100010000001011101010000000001001101010101000001101010000001010101011001011101001101000001000000100010000001010101011001011101101101010111000101101010000001000001000000010101001101011101100001011111000101011101011001010100000001001101001010010101001101001001010101000001000000000101000000010101000001011100000001011000000001000001000001010100000101000001011001010100000001000001000001011101001001101001010101000000010101011101010101000001000001010101010000100010000001010101000000000000000101010000000000100000010101011101000000100010001000100000000001010001010101000001001001000101000001000001000000010100000101011101000001010101000001011101011101000000011101011001001000100111001011001001000000100010000001010101000000100010000001010101000000100011001001011101001001100010000001011101001000100010000001000001000000100010000001010101011101011101000001011101000001011101000001011101000000011000000001001000000001010101000001000001010000000101000000000010001000100011000001010101001000101010001001010101000001100010001001011101010101000000010101000000001000100010000001010101010000011101000101000001010101010101000001011101000000011101000001010100001001010000001001000001000000000100000001011101000001011101000001010101011100000000000001000000001000100010000001011101010010011001000001101001010001011101000101011111011101011101111101010010000001010101010101010101001001010101001001011101000001011101000001001001011101001101000101010101000000100010001000100010001001101001011101011101000011000001000001010100001101000000010000000001000001000001000001010100001100010000010000010101000001000001000001001101010100000000010101010000001000100011001001000001010000000100000101011101000000100010001000000001000001000000000001010001001011001001000001010101010101010000010101000001000001100010000001010101000001010101000001001001000000100011001001010101000001101011001001010101001001100011001001101011001001100011001001010101011101001000000001010101000001010101000001000001000000100011001001010101010001001001000101011101001001100010000001011101011000010101001101001001010011011101100101000001011001010101010101010101000001010000000001000001000000001100000101011101001001000101000000000000000001010101011101001101010101001001000001010101010100000000010101011101000000100001001001011101000000011101001001000101000000000001000001001001000000010101001001010100000001101011000001000001011001010100000001001001001001000001000001000001000001101011000001010101011001010100001101000001010101010000001000100010000001011101001001011101011101000000010001011001000001000001001001001101001101001001011101010000000001000001000001100010001000000101011101001001011001011101010100000011001001100010001000100000000001010101001101000001000000000001000001000001001001100011000001001001001001100011000001000001000001100010000000000101011001010100000001010101000000100010001000010001000001001001000001000000001000100010000001011101000001011101000001011101001011101111001000000101011101000000010101011001000001000001000001011101001100000000010001011001001001000001000001001101010100000000010101011101000001010101000001000001010000000100000001001101000010010101101101100000010101001001010100000011001001100110000001010101000001010000000101000001000001100010001001101000010101011101011101001011001000100011001001011101011001011101001101010101000001101011000001000001011001001101001101011101001001101011000001010101001001010101000001010101000100100010000001010101110000010001001101001101001001100010000001011101011001011101001101010101000001100010001000000101010100000000001001000001000001000001000001001001000100000000010101011001001001010001100001100011001101101010010001110101001011011101001001011101111001010110000001000001000001100010000001010101011001011101101101001001011011010100100101001001010000010100001101010101000001011101000001001001011101000000000001000001000001000001100000000101010100000010001001101011001011100110001001011101010101010001001001011101000001001001000001010101001000010100000101001001010010010101101001000001010001001001010100000011001001100010000001011101010001011101001101010101000001101011000001010101011001010100000001000001000001101010000001000000010001001001000101000001000000100010000001010101011001011101001101010101000001011101000001010101011001011101001101010101000000100010000001011101010001010100000101011101001001100010000001010101000001011101000001010101000000011101000001011101000000000101010101001001010000010000100101001001010000011100000101010101001001101010001000000001010000001001011101011111000001001001100001011100000001010101010000011101001001001001001001000101000000000001000001000000001000100010000001011101010000010100000101001001001001101011001000000101001001010000000001000001001001100011000001000001000001000000000001010101001001100010001000000001000001000001000001000000001001100010000001011101011001000000000001010101001001101011001001010101000000100010000001000001001001101011001001011101000000100010000001000001000001000001000000000011001001100010001000100000000001000001000001000001000001100010000001010101000000100010000001000001000001000001000001000001000000100010000001010101000001101011001001001001000000100011001001000101010100001001010101010001001001000001000001000001000000100010000001010101000000100011000001000001000001000000000001010000001001101011001001010101000001000001000001010101001001101011001000000101000000000001000001000001000000100011001001011101001001100010000001000001000001100010001000000101011101011101010101010101000000100010000001000001000001000000000001010101001001011101001001001101011101000000010101011001001000100011001001010101000000000001000001000001000001100011001001000001001000000001011101010000001001101011000000000101011001011100000001001001011001010101000000001011001001100011001001100001000001000001100001000011000000100011001001100010001010100111001001000001000000100010000101011111000001100010100001011101011101010000010101011001001001010101000001101001010101010101011101001001010001011110000001011101000001010101000000010101000001000000001000100011011101011101011101100001000010000001100001001001000000010101001101011101010001111101000001010101010100000101000001000000000001010101001001011101010101011101001001011101011101010100100101011001010000010101010101010101001001011101100001011101000001011101001001011101010000010101010100001011001001011101010101011101000000100010000001010101011001011100000101011101000001011101000001011101011101100000011001000001001000100010000001010101000000100010000001011101000010100011001001101001010100000001011101011101000001011101001001011101111001010110000101000001000000100011001001010101011101011101000001010101000001000001000000000101010000010100000001010100000000100010000001000001010000010100000101001001011010010101101101001001010001011100000101011101000001011101000001011101010100000000010101011000000001000001000000000101001101010000000000000011000001000001000001000001101001000100110011011101010101001000000001011101100100000001011001010000000001001001011101011000000101011101000000001101010101010101000000000101000000000011000001000001000001100001000001000001000001010101011101011101000001011101000001010101011101000100011001011001000001000001001001001101010100000000010101011000001000100010000001000001000000100010001001010101000001011101000001010101010100000000000001001000001000100010000001010101011000011101001101011101001001100010001000000001000000000001011101011101000001011101000001001001000000001100000101011101000000100010001000000001000001000001000001000000001000100011001001011101010000011100000101011101001001101011001000000101010100000100010111010001000001100001010001011100000100000110011001010101100001010001001001010101010100000011001001010101000000100010000001011111000000100010001001101011000011000001000001000001000000000001011101001001000001011101000001011101011000010101001101000001010101011101000000100001011101011101011101011111000001011101100001011101000001011101000001011101011101010000100001000000001100100011001001011101110111011101001001011101000001011101000001011101001001111101001011011101001001011100000001001001000000010101010111011101000000100001011101010000000001011101001001101011001001100010000001011101001001100010000001011101001001101011001001011101001001101011001001101001010101010101011101011101000001001001000001000001001000010100100101011101000000100011001001011101011001011100000001011101000001011101000001011101000001011101000001011001001000011101110101011101001001100010001000100000000001010100000101001001010101011000000001001101001001100011000000000001000000100011001001011101000001011110000001111101001011000101001000000010001000000101011101001001000000001101000001011101010101010000001000100010001000100010001001010101000001011101000001011001000000100010000001000001000000100011001001011101001001011101010101001001011001010101010000100010001000100011001001011100000101011000000101001001011101010000001001101011001001010101001001011101010100000000010101010000001000100010001001100010001000000101011101001001010101011101000011011101011101011101111101000010001100101010010001110101010011011100000101011101000001011111000001011101000001010101000000010101000001001000000001010001001001000001010101011101000000100011001001101011001000100010000001000001000000100010000001010101001000100010001001101011000001000001000000000101011111000100001001000000001000100011001001000001000000000000000000010101001001100010000001000011000000010101001101010101000000100010001001010101011001010100000101011101010000100011001001001101010100000000010101011111001001010101000001010101000000100010000101010101000001101011001000101011001001100010001001101001010100000101101001010101000001101011000001010101001011010100000101001001000000100011001001000001000001001001000001010101000000010101010101011101001001011101011101010101000001000001001001100000000001010001001101001001010101011101000001011101001001111011100001010111011101101010010001111101000000100010000001011101010100000010001001101011001000100010000001000001001000010101001101001001000000000000000001010101001001100010001001000001000001000001001001100000000001010101011101001101011101000010000001011101000001000001001001010101010101011001001000100001011101010101000000000010001000100011001001011101011101011101101101010101000000100011001001000001000000000001001001011100000001011000000001001001011001010100000001000001000001010000000001010101000001011101000001011101001001000101000001000001000001010101011101011101010101011101010101010101011101010101000000000001000001010111011101011101100001011101001001011101000001010101000001000001010101010101011101000000011101011101000101010101001001010101000001011101000000100101011101011001011101011101011100000010001000000001000001010101001001010101000001011101000000010100000101001001011101010100001000100011000001000001000001001001010100000000000001000000001000100010000001011101010000011100000001011101000001011101000001010101000001010101010101001001011001010101000000000010001000110010000001010101010101011101000001011101000001010100000001010101000001010101000001000001001001100010000000000001000000100011001001010111000100001001010000100010001000000101000001000000001000100011001001010101010101010000000001010101011101000000001000100001000000001000000001010101000001001001001001010101000000100010000001000001000000000101011101011101010101011101010101011111001001100010001000100011001001100001000001000001000001000000001000100011001001011101000001011101001001011101101001010101000001101011001001101011001011100010000001010101010100000010001001101011001000100010001001100001001001010001000001000000000001010101001001100010001000100011000001000001000000100010000001010101000000100010000001010101010000011101010101010101001001010101010100001001010101010000001001000101000001010000001001011101010100000000000001000000001000000101011101010000000001000001000000000101011101010000001000000001000000000010000001011101000000100000000001010001001001001101011101011000010101011100000000001001010000011101000001010101000000000010000001010101010000010111001101010101100000010001000001010101011001010100010001100001000001000000001000100001001101011000010101001001000001011101010101011101001001101011001001010101000000100010000001010101100000110010000001010101000000100010001001100111001001101010001000110000010101110100000001000001000010011100110111100001010010111101011101011101101001100010001101101011001000100011001001011101001001100010001000100010001000101010000001000001000000010101001101000001"

pozice = s+pozice

#print pozice[0:N+1]
#print pozice[N]

if pozice[N] == "0" :
    print "-1"
else :
    n = 2
    nalezene = False
    while not nalezene :
        if (i*2 % n == 0) :
            if (i*2/n - n + 1) % 2 == 0 :
                k = (i*2/n - n + 1) / 2

                vyhravajici = False
                for a in range(n) :
                    if pozice[k+n] == 1 :
                        vyhravajici = True
                        break
                if not vyhravajici :
                    nalezene = True
                    break
        n += 1
    print n


