K = int(input())

mm = 7
cnt = 1
for i in range(10**7):
    if mm%K==0:
        print(cnt)
        break
    else:
        mm = mm*10+7
        mm %= K
        cnt += 1
else:
    print(-1) K = int(input()) K int(input()) int input() input mm = 7 mm 7 cnt = 1 cnt 1 for i in range(10**7):
    if mm%K==0:
        print(cnt)
        break
    else:
        mm = mm*10+7
        mm %= K
        cnt += 1
else:
    print(-1) i range(10**7) range 10**7 10 7 if mm%K==0:
        print(cnt)
        break
    else:
        mm = mm*10+7
        mm %= K
        cnt += 1 mm%K==0 mm%K mm K 0 print(cnt) print cnt break mm = mm*10+7 mm mm*10+7 mm*10 mm 10 7 mm %= K mm K cnt += 1 cnt 1 print(-1) print -1 mm %= K K mm K = int(input()) int(input()) K mm = 7 7 mm cnt += 1 1 cnt cnt = 1 1 cnt mm = mm*10+7 mm*10+7 mm
K = int(input())

mm = 7
cnt = 1
for i in range(10**7):
    if mm%K==0:
        print(cnt)
        break
    else:
        mm = mm*10+7
        mm %= K
        cnt += 1
else:
    print(-1)