string m, n;
cin >> m >> n;
int len = n.length();
for (int i = 0; i < n.length(); i++)
{
len = len - 1;
if (n.substr(i, 1) != "0")
{
if (i != n.length() - 1)
{
cout << n.substr(i, 1) << "*" << m << "^" << len << "+";
}
else
{
cout << n.substr(i, 1) << "*" << m << "^" << len;
}
}
}
return 0;