#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 10;
long long n, a[maxn];
char s1[maxn], s2[maxn];
vector<pair<int, int> > Ans;
int n_ex;
int find1(int s) {
  for (int i = s; i < n; i++) {
    if ((a[i] > 0 && i % 2 == 0) || (a[i] < 0 && i % 2 == 1)) {
      return i;
    }
  }
  return -1;
}
int find2(int s) {
  for (int i = s; i < n; i++) {
    if ((a[i] > 0 && i % 2 == 1) || (a[i] < 0 && i % 2 == 0)) {
      return i;
    }
  }
  return -1;
}
int main(void) {
  cin >> n;
  cin >> s1 >> s2;
  for (long long i = 0; i < n; i++) a[i] = s1[i] - s2[i];
  int flag = 1, flag1 = maxn, flag2 = maxn;
  flag1 = find1(0);
  flag2 = find2(0);
  long long all = 0;
  for (long long i = 0; i < n; i++) {
    while (a[i] != 0 && flag)
      if ((a[i] > 0 && i % 2 == 1) || (a[i] < 0 && i % 2 == 0)) {
        if (flag1 == i)
          flag1 = find1(i + 1);
        else
          flag1 = find1(flag1);
        if (flag1 == -1) {
          flag = 0;
          break;
        }
        long long num = min(abs(a[flag1]), abs(a[i]));
        all += num * (flag1 - i);
        if (abs(a[flag1]) > abs(a[i])) {
          a[i] = 0;
          if (a[flag1] > 0)
            a[flag1] -= num;
          else
            a[flag1] += num;
        } else {
          a[flag1] = 0;
          if (a[i] > 0)
            a[i] -= num;
          else
            a[i] += num;
        }
      } else if ((a[i] > 0 && i % 2 == 0) || (a[i] < 0 && i % 2 == 1)) {
        if (flag2 == i)
          flag2 = find2(i + 1);
        else
          flag2 = find2(flag2);
        if (flag2 == -1) {
          flag = 0;
          break;
        }
        long long num = min(abs(a[flag2]), abs(a[i]));
        all += num * (flag2 - i);
        if (abs(a[flag2]) > abs(a[i])) {
          a[i] = 0;
          if (a[flag2] > 0)
            a[flag2] -= num;
          else
            a[flag2] += num;
        } else {
          a[flag2] = 0;
          if (a[i] > 0)
            a[i] -= num;
          else
            a[i] += num;
        }
      }
  }
  for (long long i = 0; i < n; i++) a[i] = s1[i] - s2[i];
  if (flag) {
    for (int i = 0; i < n; i++) {
      if (a[i] != 0) {
        stack<pair<int, int> > S;
        for (int j = i + 1; j < n; j++) {
          if (Ans.size() > 100000) break;
          int flag = -1;
          if (a[i] < 0) flag = 1;
          if (((j - i) % 2 == 1 && a[i] * a[j] > 0) ||
              ((j - i) % 2 == 0 && a[i] * a[j] < 0)) {
            int num = min(abs(a[i]), abs(a[j]));
            if (Ans.size() > 100000) break;
            vector<pair<int, int> > ans;
            for (int k = i; k < j; k++) {
              if ((flag == 1 && s1[k] != '9' && s1[k + 1] != '9') ||
                  (flag == -1 && s1[k] != '0' && s1[k + 1] != '0')) {
                ans.push_back(make_pair(k, flag));
                s1[k] += flag;
                s1[k + 1] += flag;
                a[k] += flag;
                a[k + 1] += flag;
                while (!S.empty()) {
                  pair<int, int> t = S.top();
                  s1[t.first] += t.second;
                  s1[t.first + 1] += t.second;
                  a[t.first] += t.second;
                  a[t.first + 1] += t.second;
                  ans.push_back(S.top());
                  S.pop();
                }
              } else
                S.push(make_pair(k, flag));
              flag *= -1;
            }
            for (int k = 0; k < num - 1; k++)
              for (int l = 0; l < ans.size(); l++) {
                pair<int, int> t = ans[l];
                s1[t.first] += t.second;
                s1[t.first + 1] += t.second;
                a[t.first] += t.second;
                a[t.first + 1] += t.second;
              }
            for (int k = 0; k < num; k++)
              for (int l = 0; l < ans.size(); l++) {
                if (Ans.size() > 100000) break;
                Ans.push_back(ans[l]);
              }
            if (a[i] == 0) break;
          }
        }
        if (Ans.size() > 100000) break;
      }
    }
    cout << all << endl;
    int num = min(100000, (int)Ans.size());
    for (int l = 0; l < num; l++)
      printf("%d %d\n", Ans[l].first + 1, Ans[l].second);
  } else
    cout << -1;
}
