def main
  n,t = gets.chomp.split.map(&:to_i)
  poly = []
  poly = gets.chomp.split('+')
  sum = 0
  poly.each do |mono|
    num = mono.split('^')[1].to_i
    sum += n ** num
  end
  total_time = sum * t
  if total_time > 1_000_000_000
    puts 'TLE'
  else
    puts total_time
  end
end

main