#include<iostream>
#include<algorithm>
#include<map>
#include<climits>
#include<cctype>
using namespace std;
typedef long long ll;
#define reps(i,b,n) for(int i = b ; i < n ; ++i )
#define rep(i,n) reps(i,0,n)
#define INFTY (1 << 31)
#define fr first
#define sc second

int main(){
  ll n , T , ans = 0;
  string f;
  cin >> n >> T;
  cin >> f;
  for(int i = 0 ; i < f.size() ; i++ ){
    if(!isdigit(f[i])) continue;
    ll rec = 1;
    for(int j = 0 ; j < f[i] - '0' ; j++ ) rec = ( rec * n ) % (ll)INT_MAX;
    ans += rec;
    ans = min(ans,(ll)INT_MAX);
  }
  ans *= T;
  if( 1e+9 < ans ) cout << "TLE" << endl;
  else cout << ans << endl;
}