import sys
read = sys.stdin.read
#readlines = sys.stdin.readlines
from collections import defaultdict
def main():
    k = int(input())
    if k % 2 == 0:
        print(-1)
        sys.exit()
    rems = defaultdict(int)
    n = 7 % k
    next_digit = 70 % k
    r = 1
    while True:
        if n == 0:
            print(r)
            sys.exit()
        elif rems[n]:
            print(-1)
            sys.exit()
        else:
            rems[n] = 1
            n += next_digit
            n = n % k
            next_digit = (next_digit * 10) % k
            r += 1
if __name__ == '__main__':
    main() import sys sys read = sys.stdin.read read sys.stdin.read sys.stdin sys stdin read from collections import defaultdict def main():
    k = int(input())
    if k % 2 == 0:
        print(-1)
        sys.exit()
    rems = defaultdict(int)
    n = 7 % k
    next_digit = 70 % k
    r = 1
    while True:
        if n == 0:
            print(r)
            sys.exit()
        elif rems[n]:
            print(-1)
            sys.exit()
        else:
            rems[n] = 1
            n += next_digit
            n = n % k
            next_digit = (next_digit * 10) % k
            r += 1 main k = int(input()) k int(input()) int input() input if k % 2 == 0:
        print(-1)
        sys.exit()
     k % 2 == 0 k % 2 k 2 0 print(-1) print -1 sys.exit() sys.exit sys exit rems = defaultdict(int) rems defaultdict(int) defaultdict int n = 7 % k n 7 % k 7 k next_digit = 70 % k next_digit 70 % k 70 k r = 1 r 1 while True:
        if n == 0:
            print(r)
            sys.exit()
        elif rems[n]:
            print(-1)
            sys.exit()
        else:
            rems[n] = 1
            n += next_digit
            n = n % k
            next_digit = (next_digit * 10) % k
            r += 1 True if n == 0:
            print(r)
            sys.exit()
        elif rems[n]:
            print(-1)
            sys.exit()
        else:
            rems[n] = 1
            n += next_digit
            n = n % k
            next_digit = (next_digit * 10) % k
            r += 1 n == 0 n 0 print(r) print r sys.exit() sys.exit sys exit elif rems[n]:
            print(-1)
            sys.exit()
         rems[n] rems n print(-1) print -1 sys.exit() sys.exit sys exit rems[n] = 1 rems[n] rems n 1 n += next_digit n next_digit n = n % k n n % k n k next_digit = (next_digit * 10) % k next_digit (next_digit * 10) % k next_digit * 10 next_digit 10 k r += 1 r 1 if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main read = sys.stdin.read sys.stdin.read read def main():
    k = int(input())
    if k % 2 == 0:
        print(-1)
        sys.exit()
    rems = defaultdict(int)
    n = 7 % k
    next_digit = 70 % k
    r = 1
    while True:
        if n == 0:
            print(r)
            sys.exit()
        elif rems[n]:
            print(-1)
            sys.exit()
        else:
            rems[n] = 1
            n += next_digit
            n = n % k
            next_digit = (next_digit * 10) % k
            r += 1 def main():
    k = int(input())
    if k % 2 == 0:
        print(-1)
        sys.exit()
    rems = defaultdict(int)
    n = 7 % k
    next_digit = 70 % k
    r = 1
    while True:
        if n == 0:
            print(r)
            sys.exit()
        elif rems[n]:
            print(-1)
            sys.exit()
        else:
            rems[n] = 1
            n += next_digit
            n = n % k
            next_digit = (next_digit * 10) % k
            r += 1 main
import sys
read = sys.stdin.read
#readlines = sys.stdin.readlines
from collections import defaultdict
def main():
    k = int(input())
    if k % 2 == 0:
        print(-1)
        sys.exit()
    rems = defaultdict(int)
    n = 7 % k
    next_digit = 70 % k
    r = 1
    while True:
        if n == 0:
            print(r)
            sys.exit()
        elif rems[n]:
            print(-1)
            sys.exit()
        else:
            rems[n] = 1
            n += next_digit
            n = n % k
            next_digit = (next_digit * 10) % k
            r += 1
if __name__ == '__main__':
    main()
