/**
 * Created by hiroqn on 13/10/08.
 */
var fs = require('fs'),
    length = fs.fstatSync(process.stdin.fd).size,
    buffer = new Buffer(length),
    bytesRead = fs.readSync(process.stdin.fd, buffer, 0, length, 0),
    input = buffer.toString('utf8', 0, bytesRead).split('\n');
main();
function main() {
  var temp = input[0].split(' '),
      n = +temp[0],
      t = +temp[1],
      arr = input[1].split('+').map(function (str) {
        return +str[2];
      }),
      max = Math.max.apply(null, arr),
      ans;
  if (max * Math.log(n) * Math.LOG10E > 9 - Math.log(t) * Math.LOG10E) {
    console.log('TLE');
    return;
  }
  ans = arr.reduce(function (p, c) {
    return p + Math.pow(n, c);
  }, 0);
  if (ans > 1e+9 / t) {
    console.log('TLE');
  } else {
    console.log(ans * t);
  }
}