import std.stdio;
import std.ascii;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;

struct MLong {
    bool overflow;
    long value;
}

const LIMIT = 1_000_000_000;

MLong pow(long x, long n) {
    //writeln("pow: ", [x, n]);
    if (n == 0) return MLong(false, 1);
    if (n % 2 == 1) {
        MLong ret = pow(x, n - 1);
        if (ret.overflow) return ret;
        if (x * ret.value > LIMIT) return MLong(true, 0);
        return MLong(false, x * ret.value);
    } else {
        if (x * x > LIMIT) return MLong(true, 0);
        return pow(x * x, n / 2);
    }
}
 
void main() {
    long N, T; scanf("%d %d\n", &N, &T);
    string s = readln.chomp;
    
    MLong parse() {
        int index = 0;
        long num() {
            long ret;
            while (index < s.length && s[index].isDigit) {
                ret = ret * 10 + (s[index] - '0');
                index++;
            }
            return ret;
        }
        MLong mono() {
            assert(s[index] == 'n'); index++;
            assert(s[index] == '^'); index++;
            long n = num;
            return pow(N, n);
        }
        MLong poly() {
            long ret = 0;
            while (true) {
                MLong m = mono;
                if (m.overflow) return MLong(true, 0);
                ret += m.value;
                if (ret > LIMIT) return MLong(true, 0);
                if (index == s.length) break;
                assert(s[index] == '+'); index++;
            }
            return MLong(false, ret);
        }
        return poly;
    }

    MLong ans = parse;
    if (ans.overflow || ans.value * T > LIMIT) {
        writeln("TLE");
    } else {
        writeln(ans.value * T);
    }
}