#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }



const int DEFAULT_SIZE = 125;
struct Bigint : vector<long long> {
    static const long long BASE = 100000000;
    static const int BASE_DIGIT = 8;
    int sign;
    
    Bigint() : vector<long long>(1, 0) { sign = 1; }
    Bigint(long long num) : vector<long long>(DEFAULT_SIZE, 0) {
        sign = 1; if (num < 0) sign = -1;
        (*this)[0] = abs(num); 
        (*this).normalize();
    }
    Bigint(int SIZE, long long num) : vector<long long>(SIZE, 0) {
        sign = 1; if (num < 0) sign = -1;
        (*this)[0] = abs(num); 
        (*this).normalize();
    }
    
    Bigint& normalize() {
        long long c = 0;
        for (int i = 0;; ++i) {
            if (i >= (*this).size()) (*this).push_back(0);
            if ((*this)[i] < 0 && i+1 >= (*this).size()) (*this).push_back(0);
            while ((*this)[i] < 0) { (*this)[i+1] -= 1; (*this)[i] += BASE; }
            long long a = (*this)[i] + c;
            (*this)[i] = a % BASE;
            c = a / BASE;
            if (c == 0 && i == (*this).size()-1) break;
        }
        return (*this);
    }
    
    inline Bigint operator - () { 
        Bigint res = (*this); 
        bool allzero = true; for (int i = 0; i < res.size(); ++i) if (res[i] != 0) { allzero = false; break; }
        if (!allzero) res.sign *= -1; 
        return res; 
    }
    inline const Bigint& operator += (const Bigint &x);
    inline const Bigint& operator -= (const Bigint &x);
    inline const Bigint& operator *= (long long x);
    inline const Bigint& operator *= (const Bigint &x);
    inline const Bigint& operator /= (long long x);
    inline const Bigint& operator /= (const Bigint &x);
    inline const Bigint& operator %= (long long x);
    inline const Bigint& operator %= (const Bigint &x);
};

inline Bigint abs(const Bigint &x) {
    Bigint z = x;
    if (z.sign == -1) z.sign = 1;
    return z;
}
ostream &operator << (ostream &os, Bigint x) {
    if (x.sign == -1) os << '-';
    int d = x.size()-1; 
    for (d = x.size()-1; d >= 0; --d) if (x[d] > 0) break;
    if (d == -1) os << 0;
    else os << x[d];
    for (int i = d-1; i >= 0; --i) { os.width(Bigint::BASE_DIGIT); os.fill('0'); os << x[i]; }
    return os;
}
inline bool operator > (Bigint x, Bigint y) {
    x.normalize(); y.normalize();
    if (x.sign > y.sign) return true;
    else if (x.sign < y.sign) return false;
    else if (x.sign == 1) {
        for (int i = x.size()-1; i >= 0; --i) if (x[i] != y[i]) return x[i] > y[i];
        return false;
    }
    else {
        for (int i = x.size()-1; i >= 0; --i) if (x[i] != y[i]) return x[i] < y[i];
        return false;
    }
}
inline bool operator < (Bigint x, Bigint y) { return y > x; }
inline bool operator <= (Bigint x, Bigint y) { return !(y < x); }
inline bool operator >= (Bigint x, Bigint y) { return !(x < y); }
inline bool operator != (Bigint x, Bigint y) { return x < y || y < x; }
inline bool operator == (Bigint x, Bigint y) { return !(x < y) && !(y < x); }

inline Bigint operator + (Bigint x, Bigint y) {
    while (x.size() < y.size()) x.push_back(0);
    while (x.size() > y.size()) y.push_back(0);
    Bigint z((int)x.size(), 0);
    if (x.sign == y.sign) {
        z.sign = x.sign;
        for (int i = 0; i < x.size(); ++i) z[i] = x[i] + y[i];
    }
    else {
        if (x.sign == -1) swap(x, y);
        if (x >= -y) { z.sign = 1; for (int i = 0; i < x.size(); ++i) z[i] = x[i] - y[i]; }
        else { z.sign = -1; for (int i = 0; i < x.size(); ++i) z[i] = y[i] - x[i]; }
    }
    return z.normalize();
} 
inline Bigint operator - (Bigint x, Bigint y) {
    y = -y;
    return x + y;
}
inline Bigint operator * (Bigint x, long long a) {
    Bigint z((int)x.size(), 0);
    if ( (x.sign == 1 && a >= 0) || (x.sign == -1 && a < 0) ) z.sign = 1;
    else z.sign = -1;
    a = abs(a);
    for (int i = 0; i < x.size(); ++i) z[i] = x[i] * a;
    return z.normalize();
}
inline Bigint operator * (Bigint x, Bigint y) {
    int tx = x.size()-1, ty = y.size()-1; 
    for (tx = x.size()-1; tx >= 0; --tx) if (x[tx] > 0) break;
    for (ty = y.size()-1; ty >= 0; --ty) if (y[ty] > 0) break;
    Bigint z(tx+ty+5, 0);
    if (x.sign == y.sign) z.sign = 1;
    else z.sign = -1;
    for (int i = 0; i <= tx; ++i) {
        for (int j = 0; j <= ty && i+j < z.size()-1; ++j) {
            long long val = x[i] * y[j] + z[i+j];
            z[i+j+1] += val / Bigint::BASE;
            z[i+j] = val % Bigint::BASE;
        }
    }
    return z.normalize();
}
pair<Bigint, long long> divmod(Bigint x, long long a) {
    long long c = 0, t = 0;
    for (int i = x.size()-1; i >= 0; --i) {
        t = Bigint::BASE * c + x[i];
        x[i] = t / a;
        c = t % a;
    }
    x.normalize();
    return pair<Bigint, long long>(x, c);
}
Bigint operator / (Bigint x, long long a) {
    return divmod(x, a).first;
}
long long operator % (Bigint x, long long a) {
    return divmod(x, a).second;
}
pair<Bigint, Bigint> divmod(Bigint x, Bigint y) {
    Bigint zero = 0;
    if (abs(x) < abs(y)) return pair<Bigint, Bigint>(zero, x);
    Bigint ay = abs(y), q((int)x.size(), 0), r((int)y.size(), 0);
    int tx = x.size()-1; 
    for (tx = x.size()-1; tx >= 0; --tx) if (x[tx] > 0) break;
    for (int i = tx; i >= 0; --i) {
        r = r * Bigint::BASE + x[i];
        long long lo = 0, hi = Bigint::BASE;
        if (r >= ay) {
            while (hi - lo > 1) {
                int mid = (hi + lo) / 2;
                if (ay * mid > r) hi = mid;
                else lo = mid;
            }
            r = r - ay * lo;
        }
        q[i] = lo;
    }
    if (x.sign == -1 || y.sign == -1) q.sign = -1, r.sign = -1;
    return make_pair(q.normalize(), r.normalize());
}
Bigint operator / (Bigint x, Bigint y) {
    return divmod(x, y).first;
}
Bigint operator % (Bigint x, Bigint y) {
    return divmod(x, y).second;
}
inline Bigint pow(Bigint a, long long n) {
    Bigint res = 1;
    while (n > 0) { if (n & 1) { res = res * a; } a = a * a; n >>= 1; }
    return res;
}
inline const Bigint& Bigint::operator += (const Bigint &x) {*this = *this + x; return *this;}
inline const Bigint& Bigint::operator -= (const Bigint &x) {*this = *this - x; return *this;}
inline const Bigint& Bigint::operator *= (long long x) {*this = *this * x; return *this;}
inline const Bigint& Bigint::operator *= (const Bigint &x) {*this = *this * x; return *this;}
inline const Bigint& Bigint::operator /= (long long x) {*this = *this / x; return *this;}
inline const Bigint& Bigint::operator /= (const Bigint &x) {*this = *this / x; return *this;}
inline const Bigint& Bigint::operator %= (long long x) {*this = *this % x; return *this;}
inline const Bigint& Bigint::operator %= (const Bigint &x) {*this = *this % x; return *this;}



long long n, T;
string str;

int main() {
    while (cin >> n >> T >> str) {
        for (int i = 0; i < str.size(); ++i) {
            if (str[i] == 'n' || str[i] == '^' || str[i] == '+') str[i] =  ' ';
        }
        vint exp;
        istringstream sin(str);
        while (sin >> str) {
            istringstream sin2(str); int a; sin2 >> a; exp.PB(a);
        }
        
        //COUT(exp);
        
        Bigint time = 0;
        for (int i = 0; i < exp.size(); ++i) time += pow(Bigint(n), exp[i]) * T;
        
        if (time > 1000000000) puts("TLE");
        else cout << time << endl;
    }
    return 0;
}


Measured memory_bytes: 1284