/** * @FileName a.cpp * @Author kanpurin * @Created 2020.10.13 14:23:01 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { int n;cin >> n; int t;cin >> t; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } int k = max(10,t); vector> dp(n+1,vector(k+1,false)); dp[n][t] = true; for (int i = n-1; i >= 0; i--) { for (int j = 0; j <= t; j++) { if (!dp[i+1][j]) continue; if (j - a[i] <= k && j - a[i] >= 0) dp[i][j-a[i]] = true; if (j % a[i] == 0 && j / a[i] <= k) dp[i][j/a[i]] = true; } } int now = a[0]; for (int i = 2; i <= n; i++) { if (now+a[i-1] <= k && dp[i][now+a[i-1]]) { cout << '+'; now += a[i-1]; } else { cout << '*'; now *= a[i-1]; } } cout << endl; return 0; }