def function(x):
    base = 0
    for i in range(1, 10 ** 7):
        base *= 10
        base += 7
        base %= x
        if base == 0:
            return i

    return -1

x = int(input())
print(function(x)) def function(x):
    base = 0
    for i in range(1, 10 ** 7):
        base *= 10
        base += 7
        base %= x
        if base == 0:
            return i

    return -1 function base = 0 base 0 for i in range(1, 10 ** 7):
        base *= 10
        base += 7
        base %= x
        if base == 0:
            return i

     i range(1, 10 ** 7) range 1 10 ** 7 10 7 base *= 10 base 10 base += 7 base 7 base %= x base x if base == 0:
            return i

     base == 0 base 0 return i i return -1 -1 x x x = int(input()) x int(input()) int input() input print(function(x)) print function(x) function x x = int(input()) int(input()) x def function(x):
    base = 0
    for i in range(1, 10 ** 7):
        base *= 10
        base += 7
        base %= x
        if base == 0:
            return i

    return -1 def function(x):
    base = 0
    for i in range(1, 10 ** 7):
        base *= 10
        base += 7
        base %= x
        if base == 0:
            return i

    return -1 function
def function(x):
    base = 0
    for i in range(1, 10 ** 7):
        base *= 10
        base += 7
        base %= x
        if base == 0:
            return i

    return -1

x = int(input())
print(function(x))