while True:
try:
#获取输入字符
data1 = input()
#获取正整数k
k = int(input())
list1 = []
for i in range(k):
list1.append(data1[i])
print(''.join(list1))
except:
break
while True:
try:
#获取输入字符
data1 = input()
#获取正整数k
k = int(input())
list1 = []
for i in range(k):
list1.append(data1[i])
print(''.join(list1))
except:
break