S = eval(input())

w = int(eval(input()))



newS = [""] * ((len(S) - 1 + w) // w)



for i in range(len(newS)):

    newS[i] = S[w * i]



print(("".join(newS)))

S = eval(input())

w = int(eval(input()))



newS =[""]

i = 0



while i<len(S):

    newS.append(S[i])

    i = i+w



print(("".join(newS)))
S = eval(input())
w = int(eval(input()))
newS = [""] * ((len(S) - 1 + w) // w)
for i in range(len(newS)):
    newS[i] = S[w * i]
print(("".join(newS)))

S = eval(input())
w = int(eval(input()))
newS = [""]
i = 0
while i < len(S):
    newS.append(S[i])
    i = i + w
print(("".join(newS)))

-newS = [""] * ((len(S) - 1 + w) // w) -for i in range(len(newS)): -    newS[i] = S[w * i] +newS = [""] +i = 0 +while i < len(S): +    newS.append(S[i]) +    i = i + w