#include <bits/stdc++.h>
using namespace std;
char s1[100007], s2[100007], s3[100007];
int N, M, a, b, c, t, cnt, f1[100007], f2[100007];
long long ans;
void dec1(int x1);
void inc1(int x1) {
  if (s1[x1 + 1] == 9) dec1(x1 + 1);
  s1[x1]++, s1[x1 + 1]++;
  if (cnt < 100000) f1[++cnt] = x1, f2[cnt] = 1;
}
void dec1(int x1) {
  if (s1[x1 + 1] == 0) inc1(x1 + 1);
  s1[x1]--, s1[x1 + 1]--;
  if (cnt < 100000) f1[++cnt] = x1, f2[cnt] = -1;
}
int main() {
  scanf("%d", &a);
  scanf("%s", s1 + 1);
  scanf("%s", s2 + 1);
  for (int i = 1; i <= a; i++) s1[i] -= '0', s2[i] -= '0';
  for (int i = 1; i <= a; i++)
    if (i % 2)
      b += s1[i];
    else
      b -= s1[i];
  for (int i = 1; i <= a; i++)
    if (i % 2)
      c += s2[i];
    else
      c -= s2[i];
  if (b != c) {
    printf("-1\n");
    return 0;
  }
  int p = 0;
  for (int i = 1; i <= a; i++) s3[i] = s1[i];
  for (int i = 1; i <= a; i++) {
    p = max(p, i + 1);
    if (p == i + 1) {
      if (s1[i] > s2[i]) {
        while (p + 1 < a && s1[p] == 0 && s1[p + 1] == 9) p += 2;
        if (p < a && s1[p] == 0) p++;
      }
      if (s1[i] < s2[i]) {
        while (p + 1 < a && s1[p] == 9 && s1[p + 1] == 0) p += 2;
        if (p < a && s1[p] == 9) p++;
      }
    }
    while (s1[i] > s2[i]) {
      ans += p - i;
      if ((p - i) % 2) {
        s1[p]--;
        while (p < a && (((p - i) % 2 && s1[p] == 0) ||
                         ((p - i) % 2 == 0 && s1[p] == 9)))
          p++;
      } else {
        s1[p]++;
        while (p < a && (((p - i) % 2 && s1[p] == 0) ||
                         ((p - i) % 2 == 0 && s1[p] == 9)))
          p++;
      }
      s1[i]--;
    }
    while (s1[i] < s2[i]) {
      ans += p - i;
      if ((p - i) % 2 == 0) {
        s1[p]--;
        while (p < a && (((p - i) % 2 && s1[p] == 9) ||
                         ((p - i) % 2 == 0 && s1[p] == 0)))
          p++;
      } else {
        s1[p]++;
        while (p < a && (((p - i) % 2 && s1[p] == 9) ||
                         ((p - i) % 2 == 0 && s1[p] == 0)))
          p++;
      }
      s1[i]++;
    }
  }
  for (int i = 1; i <= a; i++) s1[i] = s3[i];
  for (int i = 1; i <= a; i++) {
    while (s1[i] > s2[i]) dec1(i);
    while (s1[i] < s2[i]) inc1(i);
    if (cnt >= 100000) break;
  }
  printf("%I64d\n", ans);
  for (int i = 1; i <= cnt; i++) printf("%d %d\n", f1[i], f2[i]);
  return 0;
}
