
loop do
  cards = gets.chomp
  break if str == "-" 
  num_of_shuffling = gets.chomp.to_i
  shuffle_num_of_cards = []
  num_of_shufflinge.times { shuffle_num_of_cards.push(gets.chomp.to_i) }

  shuffle_num_of_cards.each do |i|
    cards = shuffle_cards(cards, i)
  end
  puts cards
end

def shuffle_cards(cards, num_of_cards)
  retrun cards[0..(shuffle_num_of_cards-1)] + cards[shuffle_num_of_cards..-1]
end
  

end