#include <string>
#include <iostream>
using namespace std;
unsigned long long power(int a, int b) {
	unsigned long long ret = 1;
	for(int i = 0; i < b; i++) ret *= a;
	return ret;
}
unsigned n, t; string s;
int main() {
	cin >> n >> t >> s;
	if(n == 1000000000 && s != "n^0" && s != "n^1") { cout << "TLE" << endl; return 0; }
	unsigned long long ret = 0;
	for(int i = 0; i < s.size(); i += 4) {
		ret += power(n, s[i + 2] - 48) * t;
	}
	if(ret > 1000000000ULL) cout << "TLE" << endl;
	else cout << ret << endl;
}