#include <cstdio>
#include <algorithm>
using namespace std;

typedef long long LL;

int main(){
	LL n, t;
	int k;
	scanf("%lld%lld", &n, &t);

	LL tle = 1000000000 / t + 1;
	LL tm = 0;
	while(scanf(" n^%d+", &k) == 1){
		LL s = 1;
		for(int i = 0; i < k; ++i){
			s = min(s * n, tle);
		}
		tm = min(tm + s, tle);
	}

	if(tm < tle){
		printf("%lld\n", tm * t);
	}
	else{
		puts("TLE");
	}
}