gets t=gets.to_i a=gets.split.map &:to_i d=(0..n=a.size).map{[]} d[n][t]=1 n-=1 n.downto(2){|i|1.upto(t){|x|[x+a[i],x*a[i]].each{|y|d[i+1][y]&&d[i][x]=1}}} x=a[0] 1.upto(n){|i|f=d[i+1][y=x+a[i]];print'+*'[f ?1:0];x=f ?y:x*a[i]}