#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

template<class T>
vector<int> kmp(const T &sentence, const T &word) {
    int lenS = (int)sentence.size(), lenW = (int)word.size(), idx = -1, head = 0;
    vector<int> table(lenW + 1, -1), res;
    for (int i = 0; i < lenW; ++i) {
        while (idx >= 0 && word[i] != word[idx])idx = table[idx];
        table[i + 1] = ++idx;
    }

    idx = 0;
    while (head + idx < lenS) {
        if (word[idx] == sentence[head + idx]) {
            ++idx;
            if (idx == lenW) {
                res.push_back(head);
                head = head + idx - table[idx];
                idx = table[idx];
            }
        } else {
            head = head + idx - table[idx];
            if (idx > 0)idx = table[idx];
        }
    }
    return res;
}

void solve() {
    int N;
    cin >> N;
    vi A(N), B(N), AA(N), BB(2 * N);
    rep(i, N) {
        cin >> A[i];
    }
    rep(i, N) {
        cin >> B[i];
    }
    rep(i, N) {
        AA[i] = A[i] ^ A[(i + 1) % N];
        BB[i] = B[i] ^ B[(i + 1) % N];
        BB[i + N] = BB[i];
    }
    BB.pop_back();

    vi found = kmp(BB, AA);
    each(i, found) {
        i = (i == 0 ? i : N - i);
    }
    sort(all(found));

    each(i, found) {
        cout << i << ' ' << (A[i] ^ B[0]) << endl;
    }
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define MOD 1000000007

using namespace std;

typedef long long ll;

typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<string> vs;

typedef pair<ll, ll> pll;
typedef pair<int, int> pi;

typedef vector<pll> vpl;
typedef vector<pi> vpi;
typedef vector<vs> vvs;

typedef vector<pll> vvpl;
typedef vector<vpi> vvpi;

typedef queue<ll> ql;
typedef queue<int> qi;
typedef queue<pll> qpl;
typedef queue<pi> qpi;

template <typename T> void printv(const vector<T> &v) {
  for (int i = 0; i < v.size(); ++i) {
    printf("[%d] %d\n", i, v[i]);
  }
}

template <typename T> void printvv(const vector<T> &vv) {
  for (int i = 0; i < vv.size(); ++i) {
    for (int j = 0; j < vv[i].size(); ++j) {
      printf("[%d][%d] %d\n", i, j, vv[i][j]);
    }
  }
}

template <typename T, typename U> void printp(const pair<T, U> &p) {
  cout << p.first << " " << p.second << endl;
}

template <typename T> void printvp(const vector<pair<T, T>> &vp) {
  for (int i = 0; i < vp.size(); ++i) {
    printf("[%d] %d, %d\n", vp[i].first, vp[i].second);
  }
}

template <typename T> void printvvp(const vector<vector<pair<T, T>>> &vvp) {
  for (int i = 0; i < vvp.size(); ++i) {
    for (int j = 0; j < vvp[i].size(); ++j) {
      printf("[%d][%d] %d, %d\n", i, j, vvp[i][j].first, vvp[i][j].second);
    }
  }
}

int main() {
  string S;
  cin >> S;

  ll tmp = 0;
  for (int bit = 0; bit < (1 << (S.length() - 1)); ++bit) {
    tmp = S[0] - '0';
    for (int i = 1; i < S.length(); ++i) {
      if (bit & 1 << (i - 1)) {
        tmp += S[i] - '0';
      } else {
        tmp -= S[i] - '0';
      }
    }
    if (tmp == 7) {
      for (int i = 0; i < S.length(); ++i) {
        cout << S[i];
        if (i < S.length() - 1) {
          char op = (bit & (1 << i)) >= 1 ? '+' : '-';
          cout << op;
        }
      }
      cout << "=7" << endl;
      break;
    }
  }
  return 0;
}
