while(line = readline()) {
    const num = parseInt(readline());
    print(line.substring(0, num))
}