K = int(input())

cnt=1
Num=7%K
while cnt<=K:
  if K%2==0:
    print('-1')
    break
  if Num%K==0:
    print(cnt)
    break
  else:
    Num = (10*Num + 7)%K
    cnt+=1
else:
  print('-1')
 K = int(input()) K int(input()) int input() input cnt=1 cnt 1 Num=7%K Num 7%K 7 K while cnt<=K:
  if K%2==0:
    print('-1')
    break
  if Num%K==0:
    print(cnt)
    break
  else:
    Num = (10*Num + 7)%K
    cnt+=1
else:
  print('-1') cnt<=K cnt K if K%2==0:
    print('-1')
    break
   K%2==0 K%2 K 2 0 print('-1') print '-1' break if Num%K==0:
    print(cnt)
    break
  else:
    Num = (10*Num + 7)%K
    cnt+=1 Num%K==0 Num%K Num K 0 print(cnt) print cnt break Num = (10*Num + 7)%K Num (10*Num + 7)%K 10*Num + 7 10*Num 10 Num 7 K cnt+=1 cnt 1 print('-1') print '-1' cnt=1 1 cnt Num=7%K 7%K Num cnt+=1 1 cnt K = int(input()) int(input()) K Num = (10*Num + 7)%K (10*Num + 7)%K Num
K = int(input())

cnt=1
Num=7%K
while cnt<=K:
  if K%2==0:
    print('-1')
    break
  if Num%K==0:
    print(cnt)
    break
  else:
    Num = (10*Num + 7)%K
    cnt+=1
else:
  print('-1')

