#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <functional>

using namespace std;

long long int T = 1000000000;

int main() {
	long long int a, b;
	cin >> a >> b;
	string c;
	cin >> c;
	c = "+" + c;
	int N = c.size()/4;
	priority_queue<int, vector<int>, less<int> > pq;
	for (int i = 0; i < N; i++) {
		pq.push(c[3+4*i]-'0');
	}
	bool hantei = true;
	long long int p = 0;
	while (!pq.empty()) {
		int t = pq.top(); 
		pq.pop();
		long long int k = 1;
		for (int i = 0; i < t; i++) {
			k *= a;
			if (k > T) {
				hantei = false;
				break;
			}
		}
		p += k;
		if (p > T) {
			hantei = false;
			break;
		}
	}
	if (hantei) {
		p *= b;
		if (p > T) {
			hantei = false;
		}
	}
	if (hantei) {
		cout << p << endl;
	} else {
		cout << "TLE" << endl;
	}
	return 0;
}