#include <bits/stdc++.h>
using namespace std;
bool canIncrease(int i, const string& a) {
  return a[i] < '9' && a[i + 1] < '9';
}
bool canDecrease(int i, const string& a) {
  return (a[i] >= '2' || (i != 0 && a[i] >= '1')) && a[i + 1] >= '1';
}
void update(int i, vector<set<int>>& increase, vector<set<int>>& decrease,
            string& a) {
  if (!canIncrease(i, a)) {
    if (increase[i % 2].count(-i))
      increase[i % 2].erase(increase[i % 2].find(-i));
  } else {
    increase[i % 2].insert(-i);
  }
  if (!canDecrease(i, a)) {
    if (decrease[i % 2].count(-i))
      decrease[i % 2].erase(decrease[i % 2].find(-i));
  } else {
    decrease[i % 2].insert(-i);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  string a, b;
  cin >> a >> b;
  vector<set<int>> lastCanIncrease(2, set<int>());
  vector<set<int>> lastCanDecrease(2, set<int>());
  for (int i = 0; i < n - 1; ++i) {
    if (canIncrease(i, a)) lastCanIncrease[i % 2].insert(-i);
    if (canDecrease(i, a)) lastCanDecrease[i % 2].insert(-i);
  }
  long long res = 0;
  vector<pair<int, int>> ops;
  for (int i = n - 1; i >= 0;) {
    if (a[i] == b[i]) {
      --i;
      continue;
    }
    if (a[i] < b[i]) {
      int t1 = -1;
      while (lastCanIncrease[1 - i % 2].size() > 0) {
        t1 = -(*(lastCanIncrease[1 - i % 2].begin()));
        if (t1 >= i) {
          lastCanIncrease[1 - i % 2].erase(
              lastCanIncrease[1 - i % 2].find(-t1));
          t1 = -1;
        } else
          break;
      }
      int t2 = -1;
      while (lastCanDecrease[i % 2].size() > 0) {
        t2 = -(*(lastCanDecrease[i % 2].begin()));
        if (t2 >= i) {
          lastCanDecrease[i % 2].erase(lastCanDecrease[i % 2].find(-t2));
          t2 = -1;
        } else
          break;
      }
      if (t1 < 0 && t2 < 0) {
        cout << -1 << endl;
        return 0;
      }
      if (t1 > t2) {
        res += i - t1;
        if (ops.size() < 100000) {
          for (int j = t1; j < i && ops.size() < 100000; ++j)
            ops.push_back({j + 1, 1 - 2 * (j % 2 == i % 2)});
        }
        ++a[t1];
        ++a[i];
        update(t1, lastCanIncrease, lastCanDecrease, a);
        if (t1 - 1 >= 0) update(t1 - 1, lastCanIncrease, lastCanDecrease, a);
      } else {
        res += i - t2;
        if (ops.size() < 100000) {
          for (int j = t2; j < i && ops.size() < 100000; ++j)
            ops.push_back({j + 1, 1 - 2 * (j % 2 == i % 2)});
        }
        --a[t2];
        ++a[i];
        update(t2, lastCanIncrease, lastCanDecrease, a);
        if (t2 - 1 >= 0) update(t2 - 1, lastCanIncrease, lastCanDecrease, a);
      }
    } else {
      int t1 = -1;
      while (lastCanDecrease[1 - i % 2].size() > 0) {
        t1 = -(*(lastCanDecrease[1 - i % 2].begin()));
        if (t1 >= i) {
          lastCanDecrease[1 - i % 2].erase(
              lastCanDecrease[1 - i % 2].find(-t1));
          t1 = -1;
        } else
          break;
      }
      int t2 = -1;
      while (lastCanIncrease[i % 2].size() > 0) {
        t2 = -(*(lastCanIncrease[i % 2].begin()));
        if (t2 >= i) {
          lastCanIncrease[i % 2].erase(lastCanIncrease[i % 2].find(-t2));
          t2 = -1;
        } else
          break;
      }
      if (t1 < 0 && t2 < 0) {
        cout << -1 << endl;
        return 0;
      }
      if (t1 > t2) {
        res += i - t1;
        if (ops.size() < 100000) {
          for (int j = t1; j < i && ops.size() < 100000; ++j)
            ops.push_back({j + 1, 2 * (j % 2 == i % 2) - 1});
        }
        --a[t1];
        --a[i];
        update(t1, lastCanIncrease, lastCanDecrease, a);
        if (t1 - 1 >= 0) update(t1 - 1, lastCanIncrease, lastCanDecrease, a);
      } else {
        res += i - t2;
        if (ops.size() < 100000) {
          for (int j = t2; j < i && ops.size() < 100000; ++j)
            ops.push_back({j + 1, 2 * (j % 2 == i % 2) - 1});
        }
        ++a[t2];
        --a[i];
        update(t2, lastCanIncrease, lastCanDecrease, a);
        if (t2 - 1 >= 0) update(t2 - 1, lastCanIncrease, lastCanDecrease, a);
      }
    }
  }
  cout << res << endl;
  for (auto p : ops) cout << p.first << " " << p.second << endl;
  return 0;
}
