#include <bits/stdc++.h>
using namespace std;
const int MXN = 4e5 + 30;
const int MAXN = 1e3 + 2;
const long long INF = 1e9 + 7;
const long long BINF = 1e15;
const int mod = 1e9 + 7;
const long double EPS = 1e-15;
const long long dx[] = {0, 0, 1, -1};
const long long dy[] = {1, -1, 0, 0};
int n;
char second[MXN];
char t[MXN];
int a[MXN];
int b[MXN];
vector<pair<long long, long long> > ans;
set<int> st[3];
set<int>::iterator it;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> second[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> t[i];
  }
  a[1] = t[1] - second[1];
  for (int i = 2; i <= n; i++) {
    a[i] = (t[i] - second[i]) - a[i - 1];
  }
  if (a[n] != 0) {
    cout << -1;
    return 0;
  }
  long long res = 0;
  for (int j = 1; j <= n; j++) {
    res += abs(a[j]);
    if (a[j] < 0) {
      int x = max(a[j], max('0' - second[j], '0' - second[j + 1]));
      if (x == 0) continue;
      st[2].insert(j);
      b[j] = -x;
    }
    if (a[j] > 0) {
      int x = min(a[j], min('9' - second[j], '9' - second[j + 1]));
      if (x == 0) continue;
      st[1].insert(j);
      b[j] = x;
    }
  }
  int cnt = 0;
  while (st[1].size() || st[2].size()) {
    cnt++;
    if (st[1].size()) {
      it = st[1].begin();
      int i = *it, x = b[i];
      if (ans.size() < 1e5)
        for (int j = 1; j <= x; j++) {
          ans.push_back({i, 1});
        }
      second[i] += x;
      second[i + 1] += x;
      a[i] -= x;
      for (int j = max(1, i - 1); j <= min(n - 1, i + 1); j++) {
        st[1].erase(j);
        st[2].erase(j);
        if (a[j] < 0) {
          int x = max(a[j], max('0' - second[j], '0' - second[j + 1]));
          if (x == 0) continue;
          st[2].insert(j);
          b[j] = -x;
        }
        if (a[j] > 0) {
          int x = min(a[j], min('9' - second[j], '9' - second[j + 1]));
          if (x == 0) continue;
          st[1].insert(j);
          b[j] = x;
        }
      }
    } else if (st[2].size()) {
      it = st[2].begin();
      int i = *it, x = b[i];
      if (ans.size() < 1e5)
        for (int j = 1; j <= x; j++) {
          ans.push_back({i, -1});
        }
      second[i] -= x;
      second[i + 1] -= x;
      a[i] += x;
      for (int j = max(1, i - 1); j <= min(n - 1, i + 1); j++) {
        st[1].erase(j);
        st[2].erase(j);
        if (a[j] < 0) {
          int x = max(a[j], max('0' - second[j], '0' - second[j + 1]));
          if (x == 0) continue;
          st[2].insert(j);
          b[j] = -x;
        }
        if (a[j] > 0) {
          int x = min(a[j], min('9' - second[j], '9' - second[j + 1]));
          if (x == 0) continue;
          st[1].insert(j);
          b[j] = x;
        }
      }
    }
    if (st[1].size() + st[2].size() == 0 || (int)ans.size() >= (int)1e5) {
      break;
    }
  }
  if (ans.size() >= 1e5) {
    ans.resize(1e5);
  }
  cout << res << '\n';
  for (auto to : ans) {
    cout << to.first << ' ' << to.second << '\n';
  }
  return 0;
}
