
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')


# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)



# slower version:

K = int(eval(input()))



flg = [False]*K



tmp = 7 % K

cnt = 1

if tmp == 0:

    print(cnt)

    exit()

while True:

    tmp = (tmp*10+7)%K

    if flg[tmp]:

        print((-1))

        break

    else:

        cnt += 1

        if tmp == 0:

            print(cnt)

            break

        flg[tmp] = True


# optimized version of the same code:

K = int(eval(input()))

t = 7

t %= K



for i in range(K+1):

    if t == 0:

        print((i+1))

        exit()

    t = (t*10+7)%K

print((-1))

K = int(eval(input()))
flg = [False] * K
tmp = 7 % K
cnt = 1
if tmp == 0:
    print(cnt)
    exit()
while True:
    tmp = (tmp * 10 + 7) % K
    if flg[tmp]:
        print((-1))
        break
    else:
        cnt += 1
        if tmp == 0:
            print(cnt)
            break
        flg[tmp] = True

K = int(eval(input()))
t = 7
t %= K
for i in range(K + 1):
    if t == 0:
        print((i + 1))
        exit()
    t = (t * 10 + 7) % K
print((-1))

-flg = [False] * K -tmp = 7 % K -cnt = 1 -if tmp == 0: -    print(cnt) -    exit() -while True: -    tmp = (tmp * 10 + 7) % K -    if flg[tmp]: -        print((-1)) -        break -    else: -        cnt += 1 -        if tmp == 0: -            print(cnt) -            break -        flg[tmp] = True +t = 7 +t %= K +for i in range(K + 1): +    if t == 0: +        print((i + 1)) +        exit() +    t = (t * 10 + 7) % K +print((-1))