def calc(k):
    cur = 7 % k
    for i in range(1, k + 1):
        if cur == 0:
            return i
        else:
            cur *= 10
            cur += 7
            cur %= k
    return -1


k = int(input())
print(calc(k)) def calc(k):
    cur = 7 % k
    for i in range(1, k + 1):
        if cur == 0:
            return i
        else:
            cur *= 10
            cur += 7
            cur %= k
    return -1 calc cur = 7 % k cur 7 % k 7 k for i in range(1, k + 1):
        if cur == 0:
            return i
        else:
            cur *= 10
            cur += 7
            cur %= k
     i range(1, k + 1) range 1 k + 1 k 1 if cur == 0:
            return i
        else:
            cur *= 10
            cur += 7
            cur %= k
     cur == 0 cur 0 return i i cur *= 10 cur 10 cur += 7 cur 7 cur %= k cur k return -1 -1 k k k = int(input()) k int(input()) int input() input print(calc(k)) print calc(k) calc k def calc(k):
    cur = 7 % k
    for i in range(1, k + 1):
        if cur == 0:
            return i
        else:
            cur *= 10
            cur += 7
            cur %= k
    return -1 def calc(k):
    cur = 7 % k
    for i in range(1, k + 1):
        if cur == 0:
            return i
        else:
            cur *= 10
            cur += 7
            cur %= k
    return -1 calc k = int(input()) int(input()) k
def calc(k):
    cur = 7 % k
    for i in range(1, k + 1):
        if cur == 0:
            return i
        else:
            cur *= 10
            cur += 7
            cur %= k
    return -1


k = int(input())
print(calc(k))