str = input()
num = int(str)
if num % 2 == 0:
  print('-1');
else:
  i = 1
  j = 7
  while j % num != 0 and i <= num:
    j = (j % num) * 10 + 7
    i += 1
  if i > num:
    print('-1');
  else:
    print(i);
   str = input() str input() input num = int(str) num int(str) int str if num % 2 == 0:
  print('-1');
else:
  i = 1
  j = 7
  while j % num != 0 and i <= num:
    j = (j % num) * 10 + 7
    i += 1
  if i > num:
    print('-1');
  else:
    print(i);
   num % 2 == 0 num % 2 num 2 0 print('-1') print '-1' i = 1 i 1 j = 7 j 7 while j % num != 0 and i <= num:
    j = (j % num) * 10 + 7
    i += 1
   j % num != 0 and i <= num j % num != 0 j % num j num 0 i <= num i num j = (j % num) * 10 + 7 j (j % num) * 10 + 7 (j % num) * 10 j % num j num 10 7 i += 1 i 1 if i > num:
    print('-1');
  else:
    print(i);
   i > num i num print('-1') print '-1' print(i) print i i += 1 1 i j = (j % num) * 10 + 7 (j % num) * 10 + 7 j num = int(str) int(str) num i = 1 1 i str = input() input() str j = 7 7 j
str = input()
num = int(str)
if num % 2 == 0:
  print('-1');
else:
  i = 1
  j = 7
  while j % num != 0 and i <= num:
    j = (j % num) * 10 + 7
    i += 1
  if i > num:
    print('-1');
  else:
    print(i);
  
