program name
    implicit none
    integer(4)::kp(4)
    integer(4):: bit(3), ansbit(3)
    integer(4):: i,j, ans
    character(7):: cans
    character(4):: inpt


    read*, inpt

    do i=1,4
        kp(i) = ichar(inpt(i:i)) - ichar('0')
    end do

    do i=0,7
        do j=1,3
            bit(j) = and(rshift(i,j-1),1)
        end do
        ans=kp(1)
        do j=1,3
            if (bit(j) == 1) then
                ans=ans+kp(j+1)
            else
                ans=ans-kp(j+1)
            end if
        end do
        if (ans == 7) ansbit = bit
    end do

    do i=1,4
        cans(2*i-1:2*i-1) = char(kp(i)+ichar('0'))
    end do

    do i=1,3
        if (ansbit(i) == 1)then
            cans(2*i:2*i) = '+'
        else
            cans(2*i:2*i) = '-'
        end if
    end do

    print*, cans(:),'=7'
end program name