program c
integer :: I, J, K
integer :: P
integer :: sum
character,dimension(4) :: A 
integer,dimension(4) :: N

K=4

read(*,*) P
N(1) = int(P*0.001)
N(2) = int(P*0.01) - N(1)*10
N(3) = int(P*0.1) - N(1)*100 - N(2)*10
N(4) = P - N(1)*1000 - N(2)*100 - N(3)*10

sum=N(1)

do I=0,2**K-1
 do J=2,K
 if(btest(I,J)) N(J) = -N(J)
 sum=sum+N(J)
 end do
 if(sum==7) exit
 sum=N(1)
end do

do I=1,4
A(I) = "+"
if(N(I).LT.0) A(I) = "-"
N(I) = abs(N(I))
end do

print"(i0,a1,i0,a1,i0,a1,i0,a1,i0)",N(1),A(2),N(2),A(3),N(3),A(4),N(4),"=",7

end program