stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <iostream>

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int x[100000],y[100000]={0};

int main()

{

    int n;

    cin>>n;



    for(int i=1;i<=n;i++)

    {

        cin>>x[i];

    }

    for(int i=1;i<=n;i++)

    {

        if(i%2==1)

        {

            y[1]+=x[i];

        }

        else

        {

            y[1]-=x[i];

        }

    }

    for(int i=2;i<=n;i++)

    {

        y[i]=2*x[i-1]-y[i-1];

    }

    for(int i=1;i<=n;i++)

    {

        cout<<y[i]<<" ";

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

#include <cstring>

#define ll long long

using namespace std;

int a[100005],ans[100005];

int main(){

	int n,i;

	int tmp;

	scanf("%d",&n);

	for(i=0;i<n;i++){

        scanf("%d",&a[i]);

	}

	for(i=0,tmp=a[0];i<n;i++){

        tmp=a[i]-tmp;

	}

	tmp=tmp+a[0];

	tmp=tmp/2;

	for(i=0;i<n;i++){

	    printf("%d ",tmp*2);

        tmp=a[i]-tmp;



	}

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



const int MAXN = 1e5 + 5;



int n;

long long D[MAXN], M[MAXN];



int main() {

	cin >> n;

	for (int i = 0; i < n; i++) {

		cin >> D[i];

		if (i % 2 == 0)

			M[0] += D[i];

		else

			M[0] -= D[i];

	}

	for (int i = 1; i < n; i++) {

		M[i] = 2 * D[i - 1] - M[i - 1];

	}

	for (int i = 0; i < n; i++) {

		cout << M[i] << " \n"[i == n - 1];

	}

	return 0;

}


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

#include <cstring>

#define ll long long

using namespace std;

int a[100005],ans[100005];

int main(){

	int n,i;

	int tmp;

	scanf("%d",&n);

	for(i=0;i<n;i++){

        scanf("%d",&a[i]);

	}

	for(i=0,tmp=a[0];i<n;i++){

        tmp=a[i]-tmp;

	}

	tmp=tmp+a[0];

	tmp=tmp/2;

	for(i=0;i<n;i++){

	    printf("%d ",tmp*2);

        tmp=a[i]-tmp;



	}

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

using ll=long long;

using ld=long double;

using ii=pair<ll,ll>;

using vi=vector<ll>;



#define pb push_back

#define mp make_pair

#define fi first

#define se second

#define INF (ll)1e18

#define all(x) (x).begin(),(x).end()

#define print(a); for(auto x:a)cout<<x*2<<" "; cout<<"\n";

#define mset(a); memset(a,0,sizeof(a));



int main(){

	ios_base::sync_with_stdio(0);cin.tie(0);

    ll n;cin>>n;

    ll a[n];

    ll x=0;

    for(int i=0;i<n;i++){

        cin>>a[i];

        if(i%2==0)x+=a[i];

        else x-=a[i];

    }

    vi ans(n);

    ans[0]=x/2;

    for(int i=1;i<n;i++){

        ans[i]=a[i-1]-ans[i-1];

    }

    print(ans);

}


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

#include <cstring>

#define ll long long

using namespace std;

int a[100005],ans[100005];

int main(){

	int n,i;

	int tmp;

	scanf("%d",&n);

	for(i=0;i<n;i++){

        scanf("%d",&a[i]);

	}

	for(i=0,tmp=a[0];i<n;i++){

        tmp=a[i]-tmp;

	}

	tmp=tmp+a[0];

	tmp=tmp/2;

	for(i=0;i<n;i++){

	    printf("%d ",tmp*2);

        tmp=a[i]-tmp;



	}

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<cstring>

#include<cmath>

#include<algorithm>

#include<cstdlib>

#include<string>

#include<queue>

#include<map>

#include<vector>

#include<ctime>



#define ll long long

#define R register

#define IL inline

#define Rf(a,b,c) for(R int (a)=(b);(a)<=(c);++(a))

#define Tf(a,b,c) for(R int (a)=(b);(a)>=(c);--(a))

#define MP make_pair

#define PA pair<int,int>

#define MES(a,b) memset((a),(b),sizeof((a)))

#define MEC(a,b) memcpy((a),(b),sizeof((b)))

#define D double



using namespace std;



const int N=1e5+5;



int a[N],b[N],p,n;



IL int read() {

    int x=0,f=1;char ch=getchar();

    while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}

    while(ch>='0'&&ch<='9'){x*=10;x+=(ch-'0');ch=getchar();}

    return x*f;

}

IL void write(int x) {

    if(x<0) putchar('-'),x=-x;

    if(x>9) write(x/10);

    putchar(x%10+'0');

}



signed main()

{

	n=read();

	Rf(i,1,n) {

		a[i]=read();

		if(p) b[1]-=a[i];

		else b[1]+=a[i];

		p^=1;

	}

	write(b[1]);

	Rf(i,2,n) {

		putchar(' ');

		b[i]=a[i-1]*2-b[i-1]/2*2;

		write(b[i]);

	}



    return 0;

}


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

#include <cstring>

#define ll long long

using namespace std;

int a[100005],ans[100005];

int main(){

	int n,i;

	int tmp;

	scanf("%d",&n);

	for(i=0;i<n;i++){

        scanf("%d",&a[i]);

	}

	for(i=0,tmp=a[0];i<n;i++){

        tmp=a[i]-tmp;

	}

	tmp=tmp+a[0];

	tmp=tmp/2;

	for(i=0;i<n;i++){

	    printf("%d ",tmp*2);

        tmp=a[i]-tmp;



	}

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

#define ll long long

ll n, ans[100005], a[100005], temp,f = 1;

int main()

{

    //ios::sync_with_stdio(false);

    cin >> n;

    for(int i = 1; i <= n; ++i) cin >> a[i], temp += 2 * f * a[i], f *= -1;

    ans[1] = temp / 2;

    cout << ans[1] <<' ';

    for(int i = 2; i <= n; ++i){

        ans[i] = 2 * a[i - 1] - ans[i - 1];

        cout << ans[i] << ' ';

    }



    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstring>

#include<algorithm>

#include<cstdio>

#define N 100005

long long int a[N];

int n;

long long int ans=0;

int main(){

scanf("%d",&n);

for(int i=1;i<=n;i++){

scanf("%lld",&a[i]);

}

for(int i=1;i<=n;i++){

if(i%2)ans+=a[i];

else ans-=a[i];

}



for(int i=1;i<=n;i++){

long long int x=2*a[i]-ans;

printf("%lld ",ans);

ans=x;

}



}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<algorithm>

#include<cstdio>

#include <vector>

#include <map>



using namespace std;



const int maxn = 1E5 + 5;

long long A[maxn], sum, tmp[maxn], ans[maxn];

int n;



int main( )

{

	cin >> n;

	long long t;

	for( int i = 1; i <= n; ++ i )

	{

		cin >> A[i];

	}

	A[0] = A[n];

	for( int i = 1; i <= n; ++ i )

	{

		if( i == 1 )

			tmp[i] = ( A[i] - A[i - 1] );

		else

			tmp[i] = A[i] - tmp[i - 1];

	}

	ans[n] = tmp[n - 1];

	for( int i = n - 1; i >= 1; -- i )

	{

		ans[i] = 2ll * A[i] - ans[i + 1];

	}

	for( int i = 1; i <= n; ++ i )

		cout << ans[i] << " ";

	cout << endl;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;

const int maxd = 1e5+10;

int a[maxd],n;

long long b[maxd];

int main()

{

    // freopen("a.in","r",stdin);

    // freopen("k.out","w",stdout);

    scanf("%d",&n);

    for(int i=1;i<=n;i++) scanf("%d",&a[i]);

    b[1] = 0ll;

    for(int i=1;i<=n;i++)

    {

        if(i%2) b[1] += a[i];

        else b[1] -= a[i];

    }

    b[1] /=2; a[n] -= b[1];

    for(int i=1;i<n;i++)

        b[i+1] = a[i] - b[i];

    for(int i=1;i<=n;i++)

        printf("%lld ",b[i]*2);

    //printf("%lld",ans);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



#define ll long long



int main()

{

    int n;

    cin >> n;

    vector <int> a(n);

    vector <int> x(n, 0);

    for (int i=0; i<n; ++i)

        cin >> a[i];



    for (int i=0; i<n; ++i) {

        x[0] += pow(-1, i) * a[i];

    }



    for (int i=1; i<n; ++i) {

        x[i] = 2*a[i-1] - x[i-1];

    }



    for (int i=0; i<n; ++i)

        cout << x[i] << " ";



}


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;

const int maxd = 1e5+10;

int a[maxd],n;

long long b[maxd];

int main()

{

    // freopen("a.in","r",stdin);

    // freopen("k.out","w",stdout);

    scanf("%d",&n);

    for(int i=1;i<=n;i++) scanf("%d",&a[i]);

    b[1] = 0ll;

    for(int i=1;i<=n;i++)

    {

        if(i%2) b[1] += a[i];

        else b[1] -= a[i];

    }

    b[1] /=2; a[n] -= b[1];

    for(int i=1;i<n;i++)

        b[i+1] = a[i] - b[i];

    for(int i=1;i<=n;i++)

        printf("%lld ",b[i]*2);

    //printf("%lld",ans);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



int main()

{

#ifdef LOCAL

    freopen("input.txt", "r", stdin);

#endif // LOCAL

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    int n;

    cin >> n;

    vector <long long> a(n);

    for (int i = 0; i < n; i++) cin >> a[i];

    vector <long long> ans(n);

    ans[0] = 0;

    for (int i = n - 1; i >= 0; i--) {

        if (i & 1) ans[0] -= a[i];

        else ans[0] += a[i];

    }

    for (int i = 0; i < n - 1; i++) {

        ans[i + 1] = 2 * a[i] - ans[i];

    }

    for (int i = 0; i < n; i++) {

        cout << ans[i] << " ";

    }

    return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;

const int maxd = 1e5+10;

int a[maxd],n;

long long b[maxd];

int main()

{

    // freopen("a.in","r",stdin);

    // freopen("k.out","w",stdout);

    scanf("%d",&n);

    for(int i=1;i<=n;i++) scanf("%d",&a[i]);

    b[1] = 0ll;

    for(int i=1;i<=n;i++)

    {

        if(i%2) b[1] += a[i];

        else b[1] -= a[i];

    }

    b[1] /=2; a[n] -= b[1];

    for(int i=1;i<n;i++)

        b[i+1] = a[i] - b[i];

    for(int i=1;i<=n;i++)

        printf("%lld ",b[i]*2);

    //printf("%lld",ans);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



int main() {

	int n, al = 0;

	cin >> n;

	vector<int> mt(n);

	vector<int> dm(n);

	for (int i = 0; i < n; i++)

	{

		cin >> dm[i];

		al += dm[i];

	}

	for (int i = 0; i < n - 1; i += 2)

	{

		al -= dm[i] * 2;

	}

	mt[n - 1] = al;

	for (int i = n - 2; i >= 0; i--)

	{

		mt[i] = 2 * dm[i] - mt[i + 1];

	}

	for (int i = 0; i < n; i++)

	{

		cout << mt[i] << ' ';

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;

const int maxd = 1e5+10;

int a[maxd],n;

long long b[maxd];

int main()

{

    // freopen("a.in","r",stdin);

    // freopen("k.out","w",stdout);

    scanf("%d",&n);

    for(int i=1;i<=n;i++) scanf("%d",&a[i]);

    b[1] = 0ll;

    for(int i=1;i<=n;i++)

    {

        if(i%2) b[1] += a[i];

        else b[1] -= a[i];

    }

    b[1] /=2; a[n] -= b[1];

    for(int i=1;i<n;i++)

        b[i+1] = a[i] - b[i];

    for(int i=1;i<=n;i++)

        printf("%lld ",b[i]*2);

    //printf("%lld",ans);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main()

{

    long long int numlist[100000]={},sum=0,sum1,a;

    int n=0,i=0,j=0;

    cin>>n;

    for(i=0;i<n;i++)

    {

        cin>>numlist[i];

        sum+=numlist[i];

    }

    sum1=sum;

    for(i=1;i<n-1;i+=2)

    {

        sum1=sum1-2*numlist[i];

    }

    a=sum1;

    for(i=0;i<n;i++)

    {

        cout<<a<<" ";

        a=2*numlist[i]-a;

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<iostream>

#include<cstring>

#include<algorithm>

#include<cmath>

#include<map>

#include<set>

#include<vector>

using namespace std;

#define ll long long

#define db double

ll a[100005];

ll sumj[100005];

ll sumo[100005];

int main()

{

    ll n,cntj=1,cnto=1;

    scanf("%lld",&n);

    for(int i=1;i<=n;i++)

    {

        scanf("%lld",&a[i]);

        if(i%2)

        {

            sumj[cntj]=sumj[cntj-1]+a[i];

            cntj++;

        }

        else

        {

            sumo[cnto]=sumo[cnto-1]+a[i];

            cnto++;

        }

    }

    ll sum=sumj[cntj-1]+sumo[cnto-1];

    for(int i=1;i<=n;i++)

    {

        if(i%2)

        {

            ll ans=a[i]-sumj[(i-1)/2]+sumo[(i-1)/2]+(sumj[cntj-1]-sumj[(i+1)/2])-(sumo[cnto-1]-sumo[(i-1)/2]);

            printf("%lld ",ans);

        }

        else

        {

            ll ans=a[i]+sumj[i/2]-sumo[i/2-1]+(sumo[cnto-1]-sumo[i/2])-(sumj[cntj-1]-sumj[i/2]);

            printf("%lld ",ans);

        }

    }

    return 0;

}






// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <algorithm>

#include <cmath>

#include <vector>

#include <set>

#include <map>

#include <unordered_set>

#include <unordered_map>

#include <queue>

#include <ctime>

#include <cassert>

#include <complex>

#include <string>

#include <cstring>

#include <chrono>

#include <random>

#include <queue>

#include <bitset>



#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)

#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)

#define all(x) (x).begin(), (x).end()

#define clr(ar, val) memset(ar, val, sizeof(ar))

template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }

template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

int gcd(int a,int b){return b?gcd(b,a%b):a;}

using namespace std;



typedef long long ll;

typedef unsigned long long ull;

typedef pair <int,int> P;

typedef long double ld;



int main(void)

{

	ll n, a[100001], w[100001] = {};

	cin >> n;

	rep(i, n) cin >> a[i];

	rep(i, n) {

		w[i + 1] = 2 * a[i];

		a[i + 1] -= a[i];

		a[i] = 0;

	}

	ll tmp = w[n] / 2;

	rep(i, n) {

		w[i] += tmp * (i % 2 ? -1 : 1);

		cout << w[i] << (i + 1 < i_len ? ' ' : '\n');

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <algorithm>

#include <cmath>

#include <vector>

#include <set>

#include <map>

#include <unordered_set>

#include <unordered_map>

#include <queue>

#include <ctime>

#include <cassert>

#include <complex>

#include <string>

#include <cstring>

#include <chrono>

#include <random>

#include <queue>

#include <bitset>

#include <stack>

#include <functional>



#ifdef LOCAL

    #define eprintf(...) fprintf(stderr, __VA_ARGS__)

#else

    #define eprintf(...) 42

#endif



#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)

#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)

#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)

#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)

#define all(x) (x).begin(), (x).end()

template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }

template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

using namespace std;



typedef long long ll;

typedef unsigned long long ull;

typedef pair <int,int> P;

typedef long double ld;



int main (void)

{

    cin.tie(0);

    ios::sync_with_stdio(false);

    int n; cin >> n;

    vector<ll> a(n); rep (i, n) cin >> a[i];

    vector<ll> ans(n + 1); rep (i, n) ans[i + 1] = 2 * a[i] - ans[i];

    rep (i, n + 1) eprintf("%d ", ans[i]); eprintf("\n");

    ll f = ans[n] / 2;

    rep (i, n) ans[i] += f * (i % 2 == 0 ? 1LL : -1LL);

    rep (i, n) cout << ans[i] << (i != i_len - 1 ? ' ' : '\n');

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<stdio.h>

int main(void)

{

	int N,i,c;

	int *k,*kk;

	while(1){

		scanf("%d",&N);

		if(N==0) break;

		k = new int [N];

		kk = new int [N];

		for(i=0;i<N;i++)

			kk[i] = 0;

		for(i=0;i<N;i++)

			scanf("%d",&k[i]);

		

		i=0,c=0;

		while(1){

			if(k[i%N] > 0){

				k[i%N]--;

				kk[i%N]++;

				c++;

			}

			if(kk[i%N] == 2){

				printf("%d\n",c);

				break;

			}

			if(i > N * 2){

				printf("NA\n");

				break;

			}

			i++;

		}

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int k[10000];



int main()

{



	int N, cnt, same, Not;



	while( 1 ) {



		cnt = 0;

		same = 0;

		Not = 0;



		for( int i = 0; i < 10000; i++ ) k[i] = 0;



	 	scanf( "%d", &N );

		if( N == 0 ) break;

		for( int i = 0; i < N; i++ ) {



			scanf( "%d", &k[i] );

			if( k[i] > 1 ) same++;

			else if( k[i] == 0 ) Not++;



		}



		if( N == 1 && k[0] >= 2 ) {

			printf( "2\n" );

			continue;

		}

		else if( same == 0 ) {

			printf( "NA\n" );

			continue;

		}



		printf( "%d\n", N + 1 - Not );



	}



	return 0;



}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<vector>

#include<algorithm>



using namespace std;



int main(){

	int N;

	vector<int> data;



	while (1){

		data.clear();

		scanf("%d", &N);

		if (N == 0)break;



		for (int i = 0; i < N; i++){

			int temp;

			scanf("%d", &temp);

			data.push_back(temp);

		}

		bool flag = false;

		for (int i = 0; i < N; i++){

			if (data[i] > 1){

				flag = true;

				break;

			}

		}

		if (!flag){

			printf("NA\n");

		}

		else{

			if(N == 1)

				printf("2\n");

			else{

				int ans = 1;

				for (int i = 0; i < N; i++){

					if (data[i] != 0 )ans++;

				}

				printf("%d\n", ans);

			}

		}

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <vector>

#include <algorithm>



int N;



int main(){



    while(1){

start:

        scanf("%d",&N);



        if(N == 0)break;

        int cnt = 0;

        bool flag = false;



        for(int i=0;i<N;i++){

            int tmp;

            scanf("%d",&tmp);

            if(tmp != 0)cnt++;

            if(tmp > 1) flag = true;

        }

        if(N == 1 && flag){

            printf("2\n");

            goto start;

        }

        if(!flag){

            printf("NA\n");

            goto start;

        }



        int ans = cnt + 1;



        printf("%d\n",ans);

    }

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;

int a[10];

char s[10],c[10];



int main()

{

	scanf("%s",&s);

	for(int i=0;i<4;i++)

	{

		a[i]=s[i]-'0';

	}

	for(int i=1;i<=3;i++)

	{

		a[i]*=(-1);

		if(a[0]+a[1]+a[2]+a[3]==7)

		{

			for(int i=1;i<=3;i++)

			{

				if(a[i]<0) {c[i]='-';a[i]*=(-1);}

				else c[i]='+';

			}

			

			printf("%d%c%d%c%d%c%d=7",a[0],c[1],a[1],c[2],a[2],c[3],a[3]);

			return 0;

		}

	}

	for(int i=1;i<=3;i++)

	{

		a[i]*=(-1);

		if(a[0]+a[1]+a[2]+a[3]==7)

		{

			for(int i=1;i<=3;i++)

			{

				if(a[i]<0) {c[i]='-';a[i]*=(-1);}

				else c[i]='+';

			}

			

			printf("%d%c%d%c%d%c%d=7",a[0],c[1],a[1],c[2],a[2],c[3],a[3]);

			return 0;

		}

	}

	a[2]*=(-1);

	if(a[0]+a[1]+a[2]+a[3]==7)

	{

		for(int i=1;i<=3;i++)

		{

			if(a[i]<0) {c[i]='-';a[i]*=(-1);}

			else c[i]='+';

		}

		printf("%d%c%d%c%d%c%d=7",a[0],c[1],a[1],c[2],a[2],c[3],a[3]);

	}

	for(int i=1;i<=3;i++)

	{

		a[i]*=(-1);

		if(a[0]+a[1]+a[2]+a[3]==7)

		{

			for(int i=1;i<=3;i++)

			{

				if(a[i]<0) {c[i]='-';a[i]*=(-1);}

				else c[i]='+';

			}

			

			printf("%d%c%d%c%d%c%d=7",a[0],c[1],a[1],c[2],a[2],c[3],a[3]);

			return 0;

		}

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<math.h>

int main()

{

        char fuhao[4];



        int i;

        int n,nn;

        int a,b,c,d;

        scanf("%d",&n);

        nn=n;

        d=n%10;

        n/=10;

        c=n%10;

        n/=10;

        b=n%10;

        n/=10;

        a=n;

        if(a+b+c+d==7)

        {

                printf("%d+%d+%d+%d=7",a,b,c,d);

                return 0;

        }

        if(a+b+c-d==7)

        {

                printf("%d+%d+%d-%d=7",a,b,c,d);

                return 0;

        }

        if(a+b-c+d==7)

        {

                printf("%d+%d-%d+%d=7",a,b,c,d);

                return 0;

        }

        if(a+b-c-d==7)

        {

                printf("%d+%d-%d-%d=7",a,b,c,d);

                return 0;

        }

        if(a-b+c+d==7)

        {

                printf("%d-%d+%d+%d=7",a,b,c,d);

                return 0;

        }

        if(a-b+c-d==7)

        {

                printf("%d-%d+%d-%d=7",a,b,c,d);

                return 0;

        }

        if(a-b-c+d==7)

        {

                printf("%d-%d-%d+%d=7",a,b,c,d);

                return 0;

        }

        if(a-b-c-d==7)

        {

                printf("%d-%d-%d-%d=7",a,b,c,d);

                return 0;

        }

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <iostream>

#include <string>



using namespace std;



int main() {

	int a, b, c, d;

	string num;

	while (cin >> num) {

		int flag = 0;

		a = num[0] - '0';

		b = num[1] - '0';

		c = num[2] - '0';

		d = num[3] - '0';

		for (int i = 0; i < 2&&!flag; i++) {

			for (int j = 0; j < 2&&!flag; j++) {

				for (int k = 0; k < 2; k++) {

					//cout << a << b << c << d;

					if (i) b = -b;

					if (j) c = -c;

					if (k) d = -d;

					if ((a + b + c + d) == 7)

					{

						cout << a;

						if (b < 0) cout << "-" << abs(b);

						else cout << "+" << b;

						if (c < 0) cout << "-" << abs(c);

						else cout << "+" << c;

						if (d < 0) cout << "-" << abs(d);

						else cout << "+" << d;

						cout << "=7" << endl;

						flag = 1;

						break;

					}

					b = abs(b);

					c = abs(c);

					d = abs(d);

				}

			}

		}

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<math.h>

int main()

{

        char fuhao[4];



        int i;

        int n,nn;

        int a,b,c,d;

        scanf("%d",&n);

        nn=n;

        d=n%10;

        n/=10;

        c=n%10;

        n/=10;

        b=n%10;

        n/=10;

        a=n;

        if(a+b+c+d==7)

        {

                printf("%d+%d+%d+%d=7",a,b,c,d);

                return 0;

        }

        if(a+b+c-d==7)

        {

                printf("%d+%d+%d-%d=7",a,b,c,d);

                return 0;

        }

        if(a+b-c+d==7)

        {

                printf("%d+%d-%d+%d=7",a,b,c,d);

                return 0;

        }

        if(a+b-c-d==7)

        {

                printf("%d+%d-%d-%d=7",a,b,c,d);

                return 0;

        }

        if(a-b+c+d==7)

        {

                printf("%d-%d+%d+%d=7",a,b,c,d);

                return 0;

        }

        if(a-b+c-d==7)

        {

                printf("%d-%d+%d-%d=7",a,b,c,d);

                return 0;

        }

        if(a-b-c+d==7)

        {

                printf("%d-%d-%d+%d=7",a,b,c,d);

                return 0;

        }

        if(a-b-c-d==7)

        {

                printf("%d-%d-%d-%d=7",a,b,c,d);

                return 0;

        }

}

// Fastest known solution for this problem: