#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10, M = 100000;
int n, a[N], b[N], c[N], d[N];
char A[N], B[N];
vector<pair<int, int> > ans;
void ins(int x);
void dec(int x);
void inc(int x) {
  if (ans.size() == M) return;
  if (a[x + 1] == 9) dec(x + 1);
  if (ans.size() == M) return;
  ans.push_back(make_pair(x, 1));
  a[x]++;
  a[x + 1]++;
}
void dec(int x) {
  if (ans.size() == M) return;
  if (!a[x + 1]) inc(x + 1);
  if (ans.size() == M) return;
  ans.push_back(make_pair(x, -1));
  a[x]--;
  a[x + 1]--;
}
int main() {
  scanf("%d", &n);
  scanf("%s%s", A + 1, B + 1);
  for (int i = 1; i <= n; i++) a[i] = c[i] = A[i] - '0', b[i] = B[i] - '0';
  long long s = 0;
  for (int i = 1; i < n; i++)
    d[i] = b[i] - c[i], c[i] += d[i], c[i + 1] += d[i],
    s += (long long)abs(d[i]);
  if (c[n] != b[n]) return puts("-1"), 0;
  for (int i = 1; i < n; i++) {
    while (a[i] > b[i] && ans.size() < M) dec(i);
    if (ans.size() == M) break;
    while (a[i] < b[i] && ans.size() < M) inc(i);
    if (ans.size() == M) break;
  }
  printf("%lld\n", s);
  for (int i = 0; i < ans.size(); i++)
    printf("%d %d\n", ans[i].first, ans[i].second);
}
