#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const int mod = 1e9 + 7;
int n;
long long ans;
char a[N], b[N], c[N];
int p = 1;
set<int> S;
vector<pair<int, int>> v;
inline bool check(int x) {
  if (x - 1 == p) {
    if (a[x] != 0 && a[x] != 9) return 1;
    if (a[x - 1] < b[x - 1] && a[x] != 9) return 1;
    if (a[x - 1] > b[x - 1] && a[x] != 0) return 1;
  } else {
    if (a[x] != 0 && a[x] != 9) return 1;
    if (a[x] == 0 && a[x - 1] != 9) return 1;
    if (a[x] == 9 && a[x - 1] != 0) return 1;
  }
  return 0;
}
inline void del(int x) {
  if (x <= n && S.find(x) != S.end()) S.erase(S.find(x));
}
inline void update(int x) {
  if (x > n) return;
  if (!check(x)) del(x);
  if (check(x)) S.insert(x);
}
int main() {
  cin >> n;
  scanf("%s", a + 1);
  scanf("%s", b + 1);
  for (int i = 1; i <= n; ++i) {
    a[i] -= '0';
    c[i] = a[i];
    b[i] -= '0';
  }
  for (int i = 2; i <= n; ++i) {
    if (check(i)) S.insert(i);
  }
  for (int i = 1; i < n; ++i) {
    p = i;
    del(i);
    update(i + 1);
    while (a[i] < b[i]) {
      if (S.size() == 0) return puts("-1");
      a[i]++;
      int q = *S.begin();
      if ((q - i) % 2)
        a[q]++;
      else
        a[q]--;
      ans += q - i;
      update(q);
      update(q + 1);
      update(i + 1);
    }
    while (a[i] > b[i]) {
      if (S.size() == 0) return puts("-1");
      a[i]--;
      int q = *S.begin();
      if ((q - i) % 2)
        a[q]--;
      else
        a[q]++;
      ans += q - i;
      update(q);
      update(q + 1);
      update(i + 1);
    }
  }
  if (a[n] != b[n]) return puts("-1");
  printf("%I64d\n", ans);
  for (int i = 1; i <= n; ++i) a[i] = c[i];
  ans = 0;
  S.clear();
  p = 1;
  for (int i = 2; i <= n; ++i) {
    if (check(i)) S.insert(i);
  }
  for (int i = 1; i < n; ++i) {
    p = i;
    del(i);
    update(i + 1);
    while (a[i] < b[i]) {
      if (S.size() == 0) return puts("-1");
      a[i]++;
      int q = *S.begin();
      for (int j = q - 1; j >= i; --j) {
        if ((j - i) % 2)
          v.push_back(make_pair(j, -1));
        else
          v.push_back(make_pair(j, 1));
      }
      if ((q - i) % 2)
        a[q]++;
      else
        a[q]--;
      ans += q - i;
      update(q);
      update(q + 1);
      update(i + 1);
      if (ans > 1e5) break;
    }
    while (a[i] > b[i]) {
      if (S.size() == 0) return puts("-1");
      a[i]--;
      int q = *S.begin();
      for (int j = q - 1; j >= i; --j) {
        if ((j - i) % 2)
          v.push_back(make_pair(j, 1));
        else
          v.push_back(make_pair(j, -1));
      }
      if ((q - i) % 2)
        a[q]--;
      else
        a[q]++;
      ans += q - i;
      update(q);
      update(q + 1);
      update(i + 1);
      if (ans > 1e5) break;
    }
    if (ans > 1e5) break;
  }
  ans = 0;
  for (auto p : v) {
    printf("%d %d\n", p.first, p.second);
    ans++;
    if (ans == 1e5) break;
  }
}
