#include<iostream>
using namespace std;
typedef long long ll;

ll n,t;
string f;
const ll TLE = 1e9;

int main(){
  cin >> n >> t;
  cin >> f;

  ll pow[10];
  pow[0] = 1;
  for(int i=1;i<10;i++){
    if(pow[i-1]<0)pow[i] = -1;
    else pow[i] = pow[i-1] * n;
    if(pow[i] > TLE)pow[i] = -1;
  }

  ll ans = 0;
  for(int i=2;i<f.size();i+=4){
    int k = f[i]-'0';
    if(pow[k]<0){
      ans = -1;
      break;
    }
    ans += pow[k];
    if(ans>TLE)break;
  }
  if(ans<0 || ans>TLE)cout << "TLE\n";
  else if(ans*t>TLE)cout<< "TLE\n";
  else cout << ans*t << endl;
}