#include<cstdio>
#include<map>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
  ll en=1e9;
  ll n,t;
  cin>>n>>t;
  int sum=0;
  string s;
  bool h=true;
  cin>>s;
  rep(i,s.size())if(isdigit(s[i])){
    ll a=s[i]-'0';
    ll w=1;
    rep(j,a){
      w*=n;
      if(w>en){
	h=false;
	break;
      }
    }
    sum+=w;
    if(sum>en){
      h=false;
    }
    if(!h)break;
  }
  if(sum*t>en)h=false;
  if(!h)cout<<"TLE"<<endl;
  else cout<<sum*t<<endl;
}