  while (str = $stdin.gets(chomp:true)) != "-"
    tms = $stdin.gets(chomp:true).to_i
    shl_crd = []

    tms.times do
      shl_crd << $stdin.gets(chomp:true).to_i
    end

    shl_crd.each do | num |
      str << str.slice!(0...num)
    end

    puts str

  end

