#!ruby -pal
exit if$_[0]==?0
t=[?+,?-,?*]
$_=$F.permutation(4).to_a.product(t.product(t,t),[1,2,3].product([1,2])).map{|a,b,c|c.inject(a.zip(b).flatten){|s,r|r*=2;s[r-2..r]=?(+s[r-2..r]*""+?);s}*""}.find{|i|eval(i)==10}||0