#include<bits/stdc++.h>
using namespace std;
int conv(char a)
{
    return int(a)-48;
}
vector<pair<int,int>> v;
int tab[1000005];
int tab2[1000005];
int tab3[1000005];
int ile;
void rek(int a,int c)
{
    if(c==-1)
    {
        if(tab[a+1]==0)
            rek(a+1,1);
        tab[a]--;
        tab[a+1]--;
        ile++;
        cout<<a<<" "<<-1<<'\n';
    }
    else
    {
        if(tab[a+1]==9)
            rek(a+1,-1);
        tab[a]++;
        tab[a+1]++;
        ile++;
        cout<<a<<" "<<1<<'\n';
    }
    if(ile>1e5)
        return;
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
    int a;
    cin>>a;
    char znak;
    long long licz=0;
    for(int x=1;x<=a;x++)
    {
        cin>>znak;
        tab[x]=conv(znak);
        if(x%2==1)
            licz+=tab[x];
        else
            licz-=tab[x];
        tab3[x]=tab[x];
    }
    for(int x=1;x<=a;x++)
    {
        cin>>znak;
        tab2[x]=conv(znak);
        if(x%2==1)
            licz-=tab2[x];
        else
            licz+=tab2[x];
    }
    if(licz!=0)
    {
        cout<<-1;
        return 0;
    }
    licz=0;
    int pom;
    for(int x=1;x<=a;x++)
    {
        pom=tab[x]-tab2[x];
        tab[x+1]-=pom;
        licz+=abs(pom);
        tab[x]=tab3[x];
    }
    cout<<licz<<'\n';
    for(int x=1;x<=a;x++)
    {
        if(ile>1e5)
            return 0;
        while(tab[x]>tab2[x])
        {
            if(ile>1e5)
                return 0;
            rek(x,-1);
        }

        while(tab[x]<tab2[x])
        {
            if(ile>1e5)
                return 0;
            rek(x,1);
        }

    }
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int conv(char a)
{
    return int(a)-48;
}
vector<pair<int,int>> v;
int tab[1000005];
int tab2[1000005];
int tab3[1000005];
int ile;
void rek(int a,int c)
{
    if(ile>1e5)
        return;
    if(c==-1)
    {
        if(tab[a+1]==0)
            rek(a+1,1);
        if(ile>1e5)
            return;
        tab[a]--;
        tab[a+1]--;
        ile++;
        if(ile>1e5)
        return;
        cout<<a<<" "<<-1<<'\n';
    }
    else
    {
        if(tab[a+1]==9)
            rek(a+1,-1);
        if(ile>1e5)
            return;
        tab[a]++;
        tab[a+1]++;
        ile++;
        if(ile>1e5)
        return;
        cout<<a<<" "<<1<<'\n';
    }
    if(ile>1e5)
        return;
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
    int a;
    cin>>a;
    char znak;
    long long licz=0;
    for(int x=1;x<=a;x++)
    {
        cin>>znak;
        tab[x]=conv(znak);
        if(x%2==1)
            licz+=tab[x];
        else
            licz-=tab[x];
        tab3[x]=tab[x];
    }
    for(int x=1;x<=a;x++)
    {
        cin>>znak;
        tab2[x]=conv(znak);
        if(x%2==1)
            licz-=tab2[x];
        else
            licz+=tab2[x];
    }
    if(licz!=0)
    {
        cout<<-1;
        return 0;
    }
    licz=0;
    int pom;
    for(int x=1;x<=a;x++)
    {
        pom=tab[x]-tab2[x];
        tab[x+1]-=pom;
        licz+=abs(pom);
        tab[x]=tab3[x];
    }
    cout<<licz<<'\n';
    for(int x=1;x<=a;x++)
    {
        if(ile>1e5)
            return 0;
        while(tab[x]>tab2[x])
        {
            if(ile>1e5)
                return 0;
            rek(x,-1);
        }

        while(tab[x]<tab2[x])
        {
            if(ile>1e5)
                return 0;
            rek(x,1);
        }

    }
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int conv(char a)
{
    return int(a)-48;
}
vector<pair<int,int>> v;
int tab[1000005];
int tab2[1000005];
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
    int a;
    cin>>a;
    char znak;
    for(int x=1;x<=a;x++)
    {
        cin>>znak;
        tab[x]=conv(znak);
    }
    for(int x=1;x<=a;x++)
    {
        cin>>znak;
        tab2[x]=conv(znak);
    }
    bool czy=false;
    if(tab2[1]==0)
    {
        cout<<-1;
        return 0;
    }
    for(int x=1;x<a;x++)
    {
        if(tab[x]<0||tab[x]>9)
        {
            cout<<-1;
            return 0;
        }
        while(tab[x]>tab2[x])
        {
            v.push_back(make_pair(x,-1));
            tab[x+1]--;
            tab[x]--;
        }
        while(tab[x]<tab2[x])
        {
            v.push_back(make_pair(x,1));
            tab[x+1]++;
            tab[x]++;
        }
    }
    if(tab[a]!=tab2[a])
    {
        cout<<-1;
        return 0;
    }
    cout<<v.size()<<'\n';
    for(int x=0;x<min(int(v.size()),100000);x++)
        cout<<v[x].first<<" "<<v[x].second<<'\n';
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int conv(char a)
{
    return int(a)-48;
}
vector<pair<int,int>> v;
int tab[1000005];
int tab2[1000005];
int tab3[1000005];
int ile;
void rek(int a,int c)
{
    if(c==-1)
    {
        if(tab[a+1]==0)
            rek(a+1,1);
        tab[a]--;
        tab[a+1]--;
        ile++;
        cout<<a<<" "<<-1<<'\n';
    }
    else
    {
        if(tab[a+1]==9)
            rek(a+1,-1);
        tab[a]++;
        tab[a+1]++;
        ile++;
        cout<<a<<" "<<1<<'\n';
    }
    if(ile>1e5)
        return;
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
    int a;
    cin>>a;
    char znak;
    int licz=0;
    for(int x=1;x<=a;x++)
    {
        cin>>znak;
        tab[x]=conv(znak);
        if(x%2==1)
            licz+=tab[x];
        else
            licz-=tab[x];
        tab3[x]=tab[x];
    }
    for(int x=1;x<=a;x++)
    {
        cin>>znak;
        tab2[x]=conv(znak);
        if(x%2==1)
            licz-=tab2[x];
        else
            licz+=tab2[x];
    }
    if(licz!=0)
    {
        cout<<-1;
        return 0;
    }
    licz=0;
    int pom;
    for(int x=1;x<=a;x++)
    {
        pom=tab[x]-tab2[x];
        tab[x+1]-=pom;
        licz+=abs(pom);
        tab[x]=tab3[x];
    }
    cout<<licz<<'\n';
    for(int x=1;x<=a;x++)
    {
        if(ile>1e5)
            return 0;
        while(tab[x]>tab2[x])
            rek(x,-1);
        while(tab[x]<tab2[x])
            rek(x,1);
    }
	return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

#define N 100000

#define fo(i, x, y) for(int i = x; i <= y; i ++)

int a[N + 1], b[N + 1];

struct Ans { int x, y; } c[N + 1];

int n, ans = 0, cnt = 0;

void Read(int &x) {
    char ch = getchar();
    while (ch < '0' || ch > '9') ch = getchar();
    x = ch - 48;
}

int test = 0;

bool Dfs(int t, int add) {

//    if (t == 21492)
//        test = 0;

    if (t == n) return 1;
    if (a[t + 1] + add >= 0 && a[t + 1] + add <= 0) {
        a[t] += add, a[t + 1] += add;
        if (cnt < N) c[ ++ cnt ] = (Ans) { t, add };
        return 0;
    }
    return Dfs(t + 1, - add);
}

int main() {
    scanf("%d", &n);
    fo(i, 1, n) Read(a[i]);
    fo(i, 1, n) Read(b[i]);

    fo(i, 1, n - 1) {
        while (a[i] > b[i]) {
            if (! a[i + 1] && Dfs(i + 1, 1)) {
                puts("-1"); return 0;
            }
            ++ ans, -- a[i], -- a[i + 1];
            if (cnt < N) c[ ++ cnt ] = (Ans) { i, -1 };
        }
        while (a[i] < b[i]) {
            if (a[i + 1] == 9 && Dfs(i + 1, -1)) {
                puts("-1"); return 0;
            }
            ++ ans, ++ a[i], ++ a[i + 1];
            if (cnt < N) c[ ++ cnt ] = (Ans) { i, 1 };
        }
    }

    if (a[n] != b[n]) {
        puts("-1"); return 0;
    }
    printf("%d\n", ans);
    fo(i, 1, cnt) printf("%d %d\n", c[i].x, c[i].y);

    return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

#define N 100000

#define fo(i, x, y) for(int i = x; i <= y; i ++)

int a[N + 1], b[N + 1], ans[N + 1][2];

int n;

void read(int &x) {
    char ch = getchar();
    while (ch < '0' || ch > '9') ch = getchar();
    x = ch - 48;
}

int main() {
    scanf("%d\n", &n);
    fo(i, 1, n) read(a[i]);
    fo(i, 1, n) read(b[i]);

    int cnt = 0, tot = 0;
    fo(i, 1, n - 1) {
        while (a[i] < b[i] && a[i + 1] < 9) {
            ++ cnt, ++ a[i], ++ a[i + 1];
            if (tot < N) {
                ++ tot;
                ans[tot][0] = i, ans[tot][1] = 1;
            }
        }
        while (a[i] > b[i] && a[i + 1] > 0) {
            ++ cnt, -- a[i], -- a[i + 1];
            if (tot < N) {
                ++ tot;
                ans[tot][0] = i, ans[tot][1] = -1;
            }
        }
        if (a[i] != b[i]) {
            puts("-1"); return 0;
        }
    }
    if (a[n] == b[n]) {
        printf("%d\n", cnt);
        fo(i, 1, tot) printf("%d %d\n", ans[i][0], ans[i][1]);
    } else puts("-1");

    return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

#define N 100000

#define fo(i, x, y) for(int i = x; i <= y; i ++)

int a[N + 1], b[N + 1], ans[N + 1][2];

int n;

int main() {
    scanf("%d\n", &n);
    fo(i, 1, n) a[i] = getchar() - 48;
    getchar();
    fo(i, 1, n) b[i] = getchar() - 48;

    int cnt = 0, tot = 0;
    fo(i, 1, n - 1) {
        while (a[i] < b[i]) {
            ++ cnt, ++ a[i], ++ a[i + 1];
            if (tot < N) {
                ++ tot;
                ans[tot][0] = i, ans[tot][1] = 1;
            }
        }
        while (a[i] > b[i]) {
            ++ cnt, -- a[i], -- a[i + 1];
            if (tot < N) {
                ++ tot;
                ans[tot][0] = i, ans[tot][1] = -1;
            }
        }
    }
    if (a[n] == b[n]) {
        printf("%d\n", cnt);
        fo(i, 1, tot) printf("%d %d\n", ans[i][0], ans[i][1]);
    } else puts("-1");

    return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

#define N 100000

#define ll long long

#define fo(i, x, y) for(int i = x; i <= y; i ++)

int a[N + 1], b[N + 1];

struct Ans { int x, y; } c[N + 1];

int n, cnt = 0;

ll ans = 0;

void Read(int &x) {
    char ch = getchar();
    while (ch < '0' || ch > '9') ch = getchar();
    x = ch - 48;
}

ll Abs(ll x) { return x < 0 ? -x : x; }

void Dfs(int t, int add) {
    if (a[t + 1] + add < 0 || a[t + 1] + add > 9) Dfs(t + 1, - add);
    a[t] += add, a[t + 1] += add;
    if (cnt < N) ++ cnt, printf("%d %d\n", t, add);
    if (-- ans == 0) exit(0);
}

int main() {
    scanf("%d", &n);
    fo(i, 1, n) Read(a[i]);
    fo(i, 1, n) Read(b[i]);

    ll s = 0;
    fo(i, 1, n) {
        s = b[i] - a[i] - s;
        ans += Abs(s);
    }

    if (s) return puts("-1"), 0;
    printf("%lld\n", ans);
    fo(i, 1, n - 1) while (a[i] != b[i]) Dfs(i, a[i] > b[i] ? -1 : 1);

    return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

#define N 100000

#define fo(i, x, y) for(int i = x; i <= y; i ++)
#define fd(i, x, y) for(int i = x; i >= y; i --)

int a[N + 1], b[N + 1], ans[N + 1][2];

int n;

void read(int &x) {
    char ch = getchar();
    while (ch < '0' || ch > '9') ch = getchar();
    x = ch - 48;
}

int cnt = 0, tot = 0;

void FO() {
    fo(i, 1, n - 1) {
        while (a[i] < b[i] && a[i + 1] < 9) {
            ++ cnt, ++ a[i], ++ a[i + 1];
            if (tot < N) {
                ++ tot;
                ans[tot][0] = i, ans[tot][1] = 1;
            }
        }
        while (a[i] > b[i] && a[i + 1] > 0) {
            ++ cnt, -- a[i], -- a[i + 1];
            if (tot < N) {
                ++ tot;
                ans[tot][0] = i, ans[tot][1] = -1;
            }
        }
    }
}

void FD() {
    fd(i, n - 1, 1) {
        while (a[i] < b[i] && a[i + 1] < 9) {
            ++ cnt, ++ a[i], ++ a[i + 1];
            if (tot < N) {
                ++ tot;
                ans[tot][0] = i, ans[tot][1] = 1;
            }
        }
        while (a[i] > b[i] && a[i + 1] > 0) {
            ++ cnt, -- a[i], -- a[i + 1];
            if (tot < N) {
                ++ tot;
                ans[tot][0] = i, ans[tot][1] = -1;
            }
        }
    }
}

int main() {
    scanf("%d\n", &n);
    fo(i, 1, n) read(a[i]);
    fo(i, 1, n) read(b[i]);

    fo(i, 1, 100) FO(), FD();

    if (a[n] == b[n]) {
        printf("%d\n", cnt);
        fo(i, 1, tot) printf("%d %d\n", ans[i][0], ans[i][1]);
    } else puts("-1");

    return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

#define N 100000

#define ll long long

#define fo(i, x, y) for(int i = x; i <= y; i ++)

int a[N + 1], b[N + 1];

struct Ans { int x, y; } c[N + 1];

int n, cnt = 0;

ll ans = 0;

void Read(int &x) {
    char ch = getchar();
    while (ch < '0' || ch > '9') ch = getchar();
    x = ch - 48;
}

ll Abs(ll x) { return x < 0 ? -x : x; }

void Dfs(int t, int add) {
    if (a[t + 1] + add < 0 || a[t + 1] + add > 9) Dfs(t + 1, - add);
    a[t] += add, a[t + 1] += add;
    printf("%d %d\n", t, add);
    if (++ cnt == N) exit(0);
}

int main() {
    scanf("%d", &n);
    fo(i, 1, n) Read(a[i]);
    fo(i, 1, n) Read(b[i]);

    ll s = 0;
    fo(i, 1, n) {
        s = b[i] - a[i] - s;
        ans += Abs(s);
    }

    if (s) return puts("-1"), 0;
    printf("%lld\n", ans);
    fo(i, 1, n - 1) while (a[i] != b[i]) Dfs(i, a[i] > b[i] ? -1 : 1);

    return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define ull unsigned long long
#define ULL ull
#define mp make_pair
#define pii pair<int,int>
#define piii pair<int, pii >
#define pll pair <ll,ll>
#define pb push_back
#define big 20160116
#define INF 2147483647
#define pq priority_queue
#define rank rk124232
#define y1 y20160116
#define y0 y20160110
#define _ 0
using namespace std;
#ifndef MY
	#define putchar IO::_putchar
	#define getchar IO::_getchar
#endif
namespace IO
{
    const int sz=1<<15;
    char inbuf[sz],outbuf[sz];
    char *pinbuf=inbuf+sz;
    char *poutbuf=outbuf;
    inline char _getchar()
    {
        if (pinbuf==inbuf+sz)fread(inbuf,1,sz,stdin),pinbuf=inbuf;
        return *(pinbuf++);
    }
    inline void _putchar(char x)
    {
        if (poutbuf==outbuf+sz)fwrite(outbuf,1,sz,stdout),poutbuf=outbuf;
        *(poutbuf++)=x;
    }
    inline void flush()
    {
        if (poutbuf!=outbuf)fwrite(outbuf,1,poutbuf-outbuf,stdout),poutbuf=outbuf;
    }
}
inline int read()
{
    int x=0,p=1;
	char c=getchar();
    while (c<'0' || c>'9'){
    	if (c=='-') p=-1;
    	c=getchar();
	}
    while (c>='0' && c<='9') x=x*10+c-48,c=getchar();
    return x*p;
}
namespace Mymath{
	LL qp(LL x,LL p,LL mod){
		LL ans=1;
		while (p){
			if (p&1) ans=ans*x%mod;
			x=x*x%mod;
			p>>=1;
		}
		return ans;
	}
	LL inv(LL x,LL mod){
		return qp(x,mod-2,mod);
	}
	LL C(LL N,LL K,LL fact[],LL mod){
		return fact[N]*inv(fact[K],mod)%mod*inv(fact[N-K],mod)%mod;
	}
	template <typename Tp> Tp gcd(Tp A,Tp B){
		if (B==0) return A;
		return gcd(B,A%B);
	}
	template <typename Tp> Tp lcm(Tp A,Tp B){
		return A*B/gcd(A,B);
	}
};
const int Maxn=100005;
int n;
char tmp[Maxn];
int a[Maxn],b[Maxn],ta[Maxn];
int delt[Maxn];
int main(){
	scanf("%d",&n);
	scanf("%s",tmp);
	for (int i=0;i<n;i++) a[i]=tmp[i]-'0',ta[i]=a[i];
	scanf("%s",tmp);
	for (int i=0;i<n;i++) b[i]=tmp[i]-'0';
	LL ans=0;
	for (int i=0;i<n;i++){
		delt[i]=b[i]-a[i];
		ans+=abs(delt[i]);
		a[i+1]+=delt[i];
	}
	for (int i=0;i<n;i++) a[i]=ta[i];
	if (a[n]!=0){
		printf("-1\n");
		return 0;
	}
	printf("%I64d\n",ans);
	set<int> Av;
	for (int i=0;i<n-1;i++){
		if (!delt[i]) continue;
		int Nd=(delt[i]>0)?1:-1;
		if (a[i]+Nd<0 || a[i]+Nd>9 || a[i+1]+Nd<0 || a[i+1]+Nd>9){
			continue;
		}
		//cout<<i<<endl;
		Av.insert(i);
	}
	vector<pair<int,int> > Ans;
	while (!Av.empty()){
		//cout<<"f"<<" "<<*Av.begin()<<endl;
		int x=*Av.begin();
		Av.erase(x);
		if (delt[x]==0) continue;
		if (delt[x]>0){
			Ans.pb(mp(x,1));
			delt[x]--;
			a[x]++;a[x+1]++;
		}
		else{
			Ans.pb(mp(x,-1));
			delt[x]++;
			a[x]--;a[x+1]--;
		}
		if (Ans.size()==100000) break;
		if (delt[x]!=0){
			int Nd=(delt[x]>0)?1:-1;
			if (!(a[x]+Nd<0 || a[x]+Nd>9 || a[x+1]+Nd<0 || a[x+1]+Nd>9)){
				Av.insert(x);
				//cerr<<123123<<endl;
			}
		}
		if (x!=0){
			int px=x-1;
			if (delt[px]!=0){
				int Nd=(delt[px]>0)?1:-1;
				if ((a[px]+Nd<0 || a[px]+Nd>9 || a[px+1]+Nd<0 || a[px+1]+Nd>9)){
					Av.erase(px);
				}
				else{
					Av.insert(px);
				}
			}
		}
		if (x!=n-2){
			int px=x+1;
			if (delt[px]!=0){
				int Nd=(delt[px]>0)?1:-1;
				if ((a[px]+Nd<0 || a[px]+Nd>9 || a[px+1]+Nd<0 || a[px+1]+Nd>9)){
					Av.erase(px);
				}
				else{
					Av.insert(px);
				}
			}
		}
	}
	for (int i=0;i<Ans.size();i++){
		printf("%d %d\n",Ans[i].first+1,Ans[i].second);
	}
	return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define ull unsigned long long
#define ULL ull
#define mp make_pair
#define pii pair<int,int>
#define piii pair<int, pii >
#define pll pair <ll,ll>
#define pb push_back
#define big 20160116
#define INF 2147483647
#define pq priority_queue
#define rank rk124232
#define y1 y20160116
#define y0 y20160110
#define _ 0
using namespace std;
#ifndef MY
	#define putchar IO::_putchar
	#define getchar IO::_getchar
#endif
namespace IO
{
    const int sz=1<<15;
    char inbuf[sz],outbuf[sz];
    char *pinbuf=inbuf+sz;
    char *poutbuf=outbuf;
    inline char _getchar()
    {
        if (pinbuf==inbuf+sz)fread(inbuf,1,sz,stdin),pinbuf=inbuf;
        return *(pinbuf++);
    }
    inline void _putchar(char x)
    {
        if (poutbuf==outbuf+sz)fwrite(outbuf,1,sz,stdout),poutbuf=outbuf;
        *(poutbuf++)=x;
    }
    inline void flush()
    {
        if (poutbuf!=outbuf)fwrite(outbuf,1,poutbuf-outbuf,stdout),poutbuf=outbuf;
    }
}
inline int read()
{
    int x=0,p=1;
	char c=getchar();
    while (c<'0' || c>'9'){
    	if (c=='-') p=-1;
    	c=getchar();
	}
    while (c>='0' && c<='9') x=x*10+c-48,c=getchar();
    return x*p;
}
namespace Mymath{
	LL qp(LL x,LL p,LL mod){
		LL ans=1;
		while (p){
			if (p&1) ans=ans*x%mod;
			x=x*x%mod;
			p>>=1;
		}
		return ans;
	}
	LL inv(LL x,LL mod){
		return qp(x,mod-2,mod);
	}
	LL C(LL N,LL K,LL fact[],LL mod){
		return fact[N]*inv(fact[K],mod)%mod*inv(fact[N-K],mod)%mod;
	}
	template <typename Tp> Tp gcd(Tp A,Tp B){
		if (B==0) return A;
		return gcd(B,A%B);
	}
	template <typename Tp> Tp lcm(Tp A,Tp B){
		return A*B/gcd(A,B);
	}
};
const int Maxn=100005;
int n;
char tmp[Maxn];
int a[Maxn],b[Maxn],ta[Maxn];
int delt[Maxn];
int main(){
	scanf("%d",&n);
	scanf("%s",tmp);
	for (int i=0;i<n;i++) a[i]=tmp[i]-'0',ta[i]=a[i];
	scanf("%s",tmp);
	for (int i=0;i<n;i++) b[i]=tmp[i]-'0';
	LL ans=0;
	for (int i=0;i<n;i++){
		delt[i]=b[i]-a[i];
		ans+=abs(delt[i]);
		a[i+1]+=delt[i];
	}
	for (int i=0;i<n;i++) a[i]=ta[i];
	if (a[n]!=0){
		printf("-1\n");
		return 0;
	}
	printf("%I64d\n",ans);
	set<int> Av;
	for (int i=0;i<n-1;i++){
		if (!delt[i]) continue;
		int Nd=(delt[i]>0)?1:-1;
		if (a[i]+Nd<0 || a[i]+Nd>9 || a[i+1]+Nd<0 || a[i+1]+Nd>9){
			continue;
		}
		//cout<<i<<endl;
		Av.insert(i);
	}
	vector<pair<int,int> > Ans;
	while (!Av.empty()){
		//cout<<"f"<<" "<<*Av.begin()<<endl;
		int x=*Av.begin();
		Av.erase(x);
		if (delt[x]>0){
			Ans.pb(mp(x,1));
			delt[x]--;
			a[x]++;a[x+1]++;
		}
		else{
			Ans.pb(mp(x,-1));
			delt[x]++;
			a[x]--;a[x+1]--;
		}
		if (Ans.size()==100000) break;
		if (delt[x]!=0){
			int Nd=(delt[x]>0)?1:-1;
			if (!(a[x]+Nd<0 || a[x]+Nd>9 || a[x+1]+Nd<0 || a[x+1]+Nd>9)){
				Av.insert(x);
				//cerr<<123123<<endl;
			}
		}
		if (x!=0){
			int px=x-1;
			if (delt[px]!=0){
				int Nd=(delt[px]>0)?1:-1;
				if ((a[px]+Nd<0 || a[px]+Nd>9 || a[px+1]+Nd<0 || a[px+1]+Nd>9)){
					Av.erase(px);
				}
				else{
					Av.insert(px);
				}
			}
		}
	}
	for (int i=0;i<Ans.size();i++){
		printf("%d %d\n",Ans[i].first+1,Ans[i].second);
	}
	return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define ull unsigned long long
#define ULL ull
#define mp make_pair
#define pii pair<int,int>
#define piii pair<int, pii >
#define pll pair <ll,ll>
#define pb push_back
#define big 20160116
#define INF 2147483647
#define pq priority_queue
#define rank rk124232
#define y1 y20160116
#define y0 y20160110
#define _ 0
using namespace std;
#ifndef MY
	#define putchar IO::_putchar
	#define getchar IO::_getchar
#endif
namespace IO
{
    const int sz=1<<15;
    char inbuf[sz],outbuf[sz];
    char *pinbuf=inbuf+sz;
    char *poutbuf=outbuf;
    inline char _getchar()
    {
        if (pinbuf==inbuf+sz)fread(inbuf,1,sz,stdin),pinbuf=inbuf;
        return *(pinbuf++);
    }
    inline void _putchar(char x)
    {
        if (poutbuf==outbuf+sz)fwrite(outbuf,1,sz,stdout),poutbuf=outbuf;
        *(poutbuf++)=x;
    }
    inline void flush()
    {
        if (poutbuf!=outbuf)fwrite(outbuf,1,poutbuf-outbuf,stdout),poutbuf=outbuf;
    }
}
inline int read()
{
    int x=0,p=1;
	char c=getchar();
    while (c<'0' || c>'9'){
    	if (c=='-') p=-1;
    	c=getchar();
	}
    while (c>='0' && c<='9') x=x*10+c-48,c=getchar();
    return x*p;
}
namespace Mymath{
	LL qp(LL x,LL p,LL mod){
		LL ans=1;
		while (p){
			if (p&1) ans=ans*x%mod;
			x=x*x%mod;
			p>>=1;
		}
		return ans;
	}
	LL inv(LL x,LL mod){
		return qp(x,mod-2,mod);
	}
	LL C(LL N,LL K,LL fact[],LL mod){
		return fact[N]*inv(fact[K],mod)%mod*inv(fact[N-K],mod)%mod;
	}
	template <typename Tp> Tp gcd(Tp A,Tp B){
		if (B==0) return A;
		return gcd(B,A%B);
	}
	template <typename Tp> Tp lcm(Tp A,Tp B){
		return A*B/gcd(A,B);
	}
};
const int Maxn=100005;
int n;
char tmp[Maxn];
int a[Maxn],b[Maxn],ta[Maxn];
int delt[Maxn];
int main(){
	scanf("%d",&n);
	scanf("%s",tmp);
	for (int i=0;i<n;i++) a[i]=tmp[i]-'0',ta[i]=a[i];
	scanf("%s",tmp);
	for (int i=0;i<n;i++) b[i]=tmp[i]-'0';
	LL ans=0;
	for (int i=0;i<n;i++){
		delt[i]=b[i]-a[i];
		ans+=abs(delt[i]);
		a[i+1]+=delt[i];
	}
	for (int i=0;i<n;i++) a[i]=ta[i];
	if (a[n]!=0){
		printf("-1\n");
		return 0;
	}
	printf("%I64d\n",ans);
	set<int> Av;
	for (int i=0;i<n-1;i++){
		if (!delt[i]) continue;
		int Nd=(delt[i]>0)?1:-1;
		if (a[i]+Nd<0 || a[i]+Nd>9 || a[i+1]+Nd<0 || a[i+1]+Nd>9){
			continue;
		}
		Av.insert(i);
	}
	vector<pair<int,int> > Ans;
	while (!Av.empty()){
		int x=*Av.begin();
		Av.erase(x);
		if (delt[x]>0){
			Ans.pb(mp(x,1));
			delt[x]--;
			a[x]++;a[x+1]++;
		}
		else{
			Ans.pb(mp(x,-1));
			delt[x]++;
			a[x]--;a[x+1]--;
		}
		if (Ans.size()==100000) break;
		if (delt[x]!=0){
			int Nd=(delt[x]>0)?1:-1;
			if (!(a[x]+Nd<0 || a[x]+Nd>9 || a[x+1]+Nd<0 || a[x+1]+Nd>9)){
				Av.insert(x);
			}
		}
		if (x!=0){
			int px=x-1;
			if (delt[px]!=0){
				int Nd=(delt[px]>0)?1:-1;
				if ((a[px]+Nd<0 || a[px]+Nd>9 || a[px+1]+Nd<0 || a[px+1]+Nd>9)){
					Av.erase(px);
				}
			}
		}
	}
	for (int i=0;i<Ans.size();i++){
		printf("%d %d\n",Ans[i].first+1,Ans[i].second);
	}
	return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define ull unsigned long long
#define ULL ull
#define mp make_pair
#define pii pair<int,int>
#define piii pair<int, pii >
#define pll pair <ll,ll>
#define pb push_back
#define big 20160116
#define INF 2147483647
#define pq priority_queue
#define rank rk124232
#define y1 y20160116
#define y0 y20160110
#define _ 0
using namespace std;
#ifndef MY
	#define putchar IO::_putchar
	#define getchar IO::_getchar
#endif
namespace IO
{
    const int sz=1<<15;
    char inbuf[sz],outbuf[sz];
    char *pinbuf=inbuf+sz;
    char *poutbuf=outbuf;
    inline char _getchar()
    {
        if (pinbuf==inbuf+sz)fread(inbuf,1,sz,stdin),pinbuf=inbuf;
        return *(pinbuf++);
    }
    inline void _putchar(char x)
    {
        if (poutbuf==outbuf+sz)fwrite(outbuf,1,sz,stdout),poutbuf=outbuf;
        *(poutbuf++)=x;
    }
    inline void flush()
    {
        if (poutbuf!=outbuf)fwrite(outbuf,1,poutbuf-outbuf,stdout),poutbuf=outbuf;
    }
}
inline int read()
{
    int x=0,p=1;
	char c=getchar();
    while (c<'0' || c>'9'){
    	if (c=='-') p=-1;
    	c=getchar();
	}
    while (c>='0' && c<='9') x=x*10+c-48,c=getchar();
    return x*p;
}
namespace Mymath{
	LL qp(LL x,LL p,LL mod){
		LL ans=1;
		while (p){
			if (p&1) ans=ans*x%mod;
			x=x*x%mod;
			p>>=1;
		}
		return ans;
	}
	LL inv(LL x,LL mod){
		return qp(x,mod-2,mod);
	}
	LL C(LL N,LL K,LL fact[],LL mod){
		return fact[N]*inv(fact[K],mod)%mod*inv(fact[N-K],mod)%mod;
	}
	template <typename Tp> Tp gcd(Tp A,Tp B){
		if (B==0) return A;
		return gcd(B,A%B);
	}
	template <typename Tp> Tp lcm(Tp A,Tp B){
		return A*B/gcd(A,B);
	}
};
const int Maxn=100005;
int n;
char tmp[Maxn];
int a[Maxn],b[Maxn],ta[Maxn];
int delt[Maxn];
int main(){
	scanf("%d",&n);
	scanf("%s",tmp);
	for (int i=0;i<n;i++) a[i]=tmp[i]-'0',ta[i]=a[i];
	scanf("%s",tmp);
	for (int i=0;i<n;i++) b[i]=tmp[i]-'0';
	LL ans=0;
	for (int i=0;i<n;i++){
		delt[i]=b[i]-a[i];
		ans+=abs(delt[i]);
		a[i+1]+=delt[i];
	}
	for (int i=0;i<n;i++) a[i]=ta[i];
	if (a[n]!=0){
		printf("-1\n");
		return 0;
	}
	printf("%I64d\n",ans);
	set<int> Av;
	for (int i=0;i<n-1;i++){
		if (!delt[i]) continue;
		int Nd=(delt[i]>0)?1:-1;
		if (a[i]+Nd<0 || a[i]+Nd>9 || a[i+1]+Nd<0 || a[i+1]+Nd>9){
			continue;
		}
		//cout<<i<<endl;
		Av.insert(i);
	}
	vector<pair<int,int> > Ans;
	while (!Av.empty()){
		//cout<<"f"<<" "<<*Av.begin()<<endl;
		int x=*Av.begin();
		Av.erase(x);
		if (delt[x]==0) continue;
		if (delt[x]>0){
			Ans.pb(mp(x,1));
			delt[x]--;
			a[x]++;a[x+1]++;
		}
		else{
			Ans.pb(mp(x,-1));
			delt[x]++;
			a[x]--;a[x+1]--;
		}
		if (Ans.size()==100000) break;
		if (delt[x]!=0){
			int Nd=(delt[x]>0)?1:-1;
			if (!(a[x]+Nd<0 || a[x]+Nd>9 || a[x+1]+Nd<0 || a[x+1]+Nd>9)){
				Av.insert(x);
				//cerr<<123123<<endl;
			}
		}
		if (x!=0){
			int px=x-1;
			if (delt[px]!=0){
				int Nd=(delt[px]>0)?1:-1;
				if ((a[px]+Nd<0 || a[px]+Nd>9 || a[px+1]+Nd<0 || a[px+1]+Nd>9)){
					Av.erase(px);
				}
				else{
					Av.insert(px);
				}
			}
		}
	}
	for (int i=0;i<Ans.size();i++){
		printf("%d %d\n",Ans[i].first+1,Ans[i].second);
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<cstring>
#define N 101000
#define inf 21474836
using namespace std;
long long ans;
int n,a[N],b[N],c[N];
char x;
void dfs(int x,int o) {
	if(!ans) return ;
	if(a[x+1]+o>=0&&a[x+1]+o<=9) {
		printf("%d %d\n",x,o);
		a[x]+=o;
		a[x+1]+=o;
		ans--;
		return ;
	}
	dfs(x+1,-o);
	if(!ans) return ;
	printf("%d %d\n",x,o);
	a[x]+=o;
	a[x+1]+=o;
	ans--;
	return ;
}
int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++) {
		cin>>x;
		a[i]=x-'0';
		c[i]=a[i];
	}
	for(int i=1;i<=n;i++) {
		cin>>x;
		b[i]=x-'0';
	}
	for(int i=1;i<n;i++) {
		int d=b[i]-c[i];
		c[i]=b[i];
		c[i+1]+=d;
		ans+=abs(d);
	}
	if(c[n]!=b[n]) {
		printf("-1");
		return 0;
	}
	printf("%d\n",ans);
	ans=min(ans,100000ll);
	for(int i=1;i<n;i++) {
		if(!ans) return 0;
		while(a[i]!=b[i]&&ans) dfs(i,(b[i]-a[i])>0?1:-1);
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<cstring>
#define N 101000
#define inf 21474836
using namespace std;
long long ans;
int n,a[N],b[N],c[N];
char x;
void dfs(int x,int o) {
	if(!ans) return ;
	if(a[x]+o>=0&&a[x]+o<=9) {
		printf("%d %d\n",x,o);
		a[x]+=o;
		a[x+1]+=o;
		ans--;
		return ;
	}
	dfs(x+1,-o);
	if(!ans) return ;
	printf("%d %d\n",x,o);
	a[x]+=o;
	a[x+1]+=o;
	ans--;
	return ;
}
int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++) {
		cin>>x;
		a[i]=x-'0';
		c[i]=a[i];
	}
	for(int i=1;i<=n;i++) {
		cin>>x;
		b[i]=x-'0';
	}
	for(int i=1;i<n;i++) {
		int d=b[i]-c[i];
		c[i]=b[i];
		c[i+1]+=d;
		ans+=abs(d);
	}
	if(c[n]!=b[n]) {
		printf("-1");
		return 0;
	}
	printf("%d\n",ans);
	ans=min(ans,100000ll);
	for(int i=1;i<n;i++) {
		if(!ans) return 0;
		while(a[i]!=b[i]&&ans) dfs(i,(b[i]-a[i])>0?1:-1);
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<cstring>
#define N 101000
#define inf 21474836
using namespace std;
long long ans;
int n,a[N],b[N],c[N];
char x;
void dfs(int x,int o) {
	if(!ans) return ;
	if(a[x+1]+o>=0&&a[x+1]+o<=9) {
		printf("%d %d\n",x,o);
		a[x]+=o;
		a[x+1]+=o;
		ans--;
		return ;
	}
	dfs(x+1,-o);
	if(!ans) return ;
	printf("%d %d\n",x,o);
	a[x]+=o;
	a[x+1]+=o;
	ans--;
	return ;
}
int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++) {
		cin>>x;
		a[i]=x-'0';
		c[i]=a[i];
	}
	for(int i=1;i<=n;i++) {
		cin>>x;
		b[i]=x-'0';
	}
	for(int i=1;i<n;i++) {
		int d=b[i]-c[i];
		c[i]=b[i];
		c[i+1]+=d;
		ans+=abs(d)*1ll;
	}
	if(c[n]!=b[n]) {
		printf("-1");
		return 0;
	}
	printf("%d\n",ans);
	ans=min(ans,100000ll);
	for(int i=1;i<n;i++) {
		if(!ans) return 0;
		while(a[i]!=b[i]&&ans) dfs(i,(b[i]-a[i])/abs(b[i]-a[i]));
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<cstring>
#define N 101
#define inf 21474836
using namespace std;
long long ans;
int n,a[N],b[N],c[N];
char x;
void dfs(int x,int o) {
	if(!ans) return ;
	if(a[x]+o>=0&&a[x]+o<=9) {
		printf("%d %d\n",x,o);
		a[x]+=o;
		a[x+1]+=o;
		ans--;
		return ;
	}
	dfs(a[x+1],-o);
	if(!ans) return ;
	printf("%d %d\n",x,o);
	a[x]+=o;
	a[x+1]+=o;
	ans--;
	return ;
}
int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++) {
		cin>>x;
		a[i]=x-'0';
		c[i]=a[i];
	}
	for(int i=1;i<=n;i++) {
		cin>>x;
		b[i]=x-'0';
	}
	for(int i=1;i<n;i++) {
		int d=b[i]-c[i];
		c[i]=b[i];
		c[i+1]+=d;
		ans+=abs(d);
	}
	if(c[n]!=b[n]) {
		printf("-1");
		return 0;
	}
	printf("%d\n",ans);
	ans=min(ans,100000ll);
	for(int i=1;i<n;i++) {
		if(!ans) return 0;
		while(a[i]!=b[i]&&ans) dfs(i,(b[i]-a[i])>0?1:-1);
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<cstring>
#define N 101000
#define inf 21474836
using namespace std;
long long ans;
int n,a[N],b[N],c[N];
char x;
void dfs(int x,int o) {
	if(!ans) return ;
	if(a[x+1]+o>=0&&a[x+1]+o<=9) {
		printf("%d %d\n",x,o);
		a[x]+=o;
		a[x+1]+=o;
		ans--;
		return ;
	}
	dfs(x+1,-o);
	if(!ans) return ;
	printf("%d %d\n",x,o);
	a[x]+=o;
	a[x+1]+=o;
	ans--;
	return ;
}
int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++) {
		cin>>x;
		a[i]=x-'0';
		c[i]=a[i];
	}
	for(int i=1;i<=n;i++) {
		cin>>x;
		b[i]=x-'0';
	}
	for(int i=1;i<n;i++) {
		int d=b[i]-c[i];
		c[i]=b[i];
		c[i+1]+=d;
		ans+=abs(d)*1ll;
	}
	if(c[n]!=b[n]) {
		printf("-1");
		return 0;
	}
	printf("%I64d\n",ans);
	ans=min(ans,100000ll);
	for(int i=1;i<n;i++) {
		if(!ans) return 0;
		while(a[i]!=b[i]&&ans) dfs(i,(b[i]-a[i])>0?1:-1);
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<cstring>
#define N 101000
#define inf 21474836
using namespace std;
long long ans;
int n,a[N],b[N],c[N];
char x;
void dfs(int x,int o) {
	if(!ans) return ;
	if(a[x]+o>=0&&a[x]+o<=9) {
		printf("%d %d\n",x,o);
		a[x]+=o;
		a[x+1]+=o;
		ans--;
		return ;
	}
	dfs(a[x+1],-o);
	if(!ans) return ;
	printf("%d %d\n",x,o);
	a[x]+=o;
	a[x+1]+=o;
	ans--;
	return ;
}
int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++) {
		cin>>x;
		a[i]=x-'0';
		c[i]=a[i];
	}
	for(int i=1;i<=n;i++) {
		cin>>x;
		b[i]=x-'0';
	}
	for(int i=1;i<n;i++) {
		int d=b[i]-c[i];
		c[i]=b[i];
		c[i+1]+=d;
		ans+=abs(d);
	}
	if(c[n]!=b[n]) {
		printf("-1");
		return 0;
	}
	printf("%d\n",ans);
	ans=min(ans,100000ll);
	for(int i=1;i<n;i++) {
		if(!ans) return 0;
		while(a[i]!=b[i]&&ans) dfs(i,(b[i]-a[i])>0?1:-1);
	}
	return 0;
}


#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

#define LL long long
#define fgx cerr<<"--------------"<<endl;
#define dgx cerr<<"=============="<<endl;

inline int read(){
	int x=0,f=1;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*f;
}
const int MAXN = 100010;
const int MAX = 100000;
const int INF = 2147483600;

int a[MAXN+1],b[MAXN+1],c[MAXN+1],d[MAXN+1];
LL suma[2],sumb[2];
int N; char s[MAXN+1],t[MAXN+1];
int post[MAXN+1],oprt[MAXN+1],top;
inline void OP(int pos,int opr){
	a[pos]+=opr; a[pos+1]+=opr;
	post[++top]=pos; oprt[top]=opr;
	return ;
}
inline bool Can(int pos,int opr){
	return ((a[pos]+opr<10&&a[pos]+opr>=0&&a[pos+1]+opr<10&&a[pos+1]+opr>=0)&&pos<N);
}

int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	N=read(); scanf("%s",s+1); scanf("%s",t+1);
	for(int i=1;i<=N;i++) a[i]=s[i]-'0',b[i]=t[i]-'0';
	for(int i=1;i<=N;i++) suma[i&1]+=a[i];
	for(int i=1;i<=N;i++) sumb[i&1]+=b[i];
	if(suma[0]-suma[1]!=sumb[0]-sumb[1]){ puts("-1"); return 0; }
	LL ans=abs((sumb[0]+sumb[1])-(suma[0]+suma[1]))/2;
	LL dsum=((sumb[0]+sumb[1])-(suma[0]+suma[1]))/2;
	memcpy(c,a,sizeof(a));
	memcpy(d,b,sizeof(b));
	LL sum[2]; sum[0]=sum[1]=0;
	for(int i=1;i<=N;i++){
		sum[i&1]+=a[i]-b[i];
		while(sum[i&1]<0&&Can(i,1)&&dsum>0) --dsum,OP(i,1),++sum[i&1];
		while(sum[i&1]>0&&Can(i,-1)&&dsum<0) ++dsum,OP(i,-1),--sum[i&1];
		ans+=abs(sum[0])+abs(sum[1]);
	}
	dsum=((sumb[0]+sumb[1])-(suma[0]+suma[1]))/2;
	top=0;
	printf("%lld\n",ans);
	memcpy(a,c,sizeof(a));
	memcpy(b,d,sizeof(b));
	for(int i=1;i<N;i++){
		if(a[i]!=b[i]){
			if(a[i]<b[i]){
				while(a[i]<b[i]){
					if(dsum>0&&Can(i,1)) --dsum,OP(i,1);
					else {
						int pos=-1;
						for(int j=i;j<=N;j+=2)
							if(a[j]>b[j]){ pos=j; break; }
						int ad=i,mn=i+1;
						for(int j=i;j<=pos;j+=2){
							while(Can(ad,1)&&ad<pos) OP(ad,1),ad+=2;
							while(Can(mn,-1)&&mn<pos) OP(mn,-1),mn+=2;
						}
						if(ad==i&&mn==i+1){
							mn=pos-1; ad=pos-2;
							for(int j=i;j<=pos;j+=2){
								while(Can(mn,-1)&&mn>i) OP(mn,-1),mn-=2;
								while(Can(ad,1)&&ad>=i) OP(ad,1),ad-=2;
							}
						}
					} if(top>=MAX) break;
				}
			} else{
				while(a[i]>b[i]){
					if(dsum<0&&Can(i,-1)) ++dsum,OP(i,-1);
					else {
						int pos=-1;
						for(int j=i;j<=N;j+=2)
							if(a[j]<b[j]){ pos=j; break; }
						int mn=i,ad=i+1;
						for(int j=i;j<=pos;j+=2){
							while(Can(mn,-1)&&mn<pos) OP(mn,-1),mn+=2;
							while(Can(ad,1)&&ad<pos) OP(ad,1),ad+=2;
						}
						if(ad==i+1&&mn==i){
							mn=pos-2; ad=pos-1;
							for(int j=i;j<=pos;j+=2){
								while(Can(ad,1)&&ad>i) OP(ad,1),ad-=2;
								while(Can(mn,-1)&&mn>=i) OP(mn,-1),mn-=2;
							}
						}
					} if(top>=MAX) break;
				}
			}
		} if(top>=MAX) break;
	}
	for(int i=1;i<=min(top,MAX);i++){
		printf("%d %d\n",post[i],oprt[i]);
	}
	return 0;
}


#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

#define LL long long
#define fgx cerr<<"--------------"<<endl;
#define dgx cerr<<"=============="<<endl;

inline int read(){
	int x=0,f=1;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*f;
}
const int MAXN = 100010;
const int MAX = 100000;
const int INF = 2147483600;

int a[MAXN+1],b[MAXN+1],c[MAXN+1],d[MAXN+1];
LL suma[2],sumb[2];
int N; char s[MAXN+1],t[MAXN+1];
int post[MAXN+1],oprt[MAXN+1],top;
inline void OP(int pos,int opr){
	a[pos]+=opr; a[pos+1]+=opr;
	if(top<MAX){ post[++top]=pos; oprt[top]=opr; }
	return ;
}
inline bool Can(int pos,int opr){
	return ((a[pos]+opr<10&&a[pos]+opr>=0&&a[pos+1]+opr<10&&a[pos+1]+opr>=0)&&pos<N);
}
int f[MAXN+1];
inline int val(int x){
	return (x<0?-1:1);
}
inline void dfs(int k){
	if(!f[k]) return ;
	//cout<<"yes:"<<k<<" "<<f[k]<<" "<<Can(k,val(f[k]))<<" "<<val(f[k])<<" "<<a[1]<<" "<<a[2]<<endl;
	if(top>=MAX) return ;
	while(f[k]&&Can(k,val(f[k]))) OP(k,val(f[k])),f[k]-=val(f[k]);
	dfs(k-1); dfs(k+1); return ;
}

int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	N=read(); scanf("%s",s+1); scanf("%s",t+1);
	for(int i=1;i<=N;i++) a[i]=s[i]-'0',b[i]=t[i]-'0';
	for(int i=1;i<=N;i++) suma[i&1]+=a[i];
	for(int i=1;i<=N;i++) sumb[i&1]+=b[i];
	if(suma[0]-suma[1]!=sumb[0]-sumb[1]){ puts("-1"); return 0; }
	LL ans=0;
	LL dsum=((sumb[0]+sumb[1])-(suma[0]+suma[1]))/2;
	memcpy(c,a,sizeof(a));
	memcpy(d,b,sizeof(b));
	LL sum=0; //sum[0]=sum[1]=0;
	for(int i=1;i<=N;i++){
		f[i-1]=sum;
		sum=-sum+b[i]-a[i];
		ans+=abs(sum);
	}
	dsum=((sumb[0]+sumb[1])-(suma[0]+suma[1]))/2;
	top=0;
	printf("%lld\n",ans);
	memcpy(a,c,sizeof(a));
	memcpy(b,d,sizeof(b));
	for(int i=1;i<N;i++) dfs(i);
	for(int i=1;i<=min(top,MAX);i++){
		printf("%d %d\n",post[i],oprt[i]);
	}
	return 0;
}


#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

#define LL long long
#define fgx cerr<<"--------------"<<endl;
#define dgx cerr<<"=============="<<endl;

inline int read(){
	int x=0,f=1;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*f;
}
const int MAXN = 100010;
const int MAX = 100000;
const int INF = 2147483600;

int a[MAXN+1],b[MAXN+1],c[MAXN+1],d[MAXN+1];
LL suma[2],sumb[2];
int N; char s[MAXN+1],t[MAXN+1];
int post[MAXN+1],oprt[MAXN+1],top;
inline void OP(int pos,int opr){
	a[pos]+=opr; a[pos+1]+=opr;
	post[++top]=pos; oprt[top]=opr;
	return ;
}
inline bool Can(int pos,int opr){
	return (a[pos]+opr<10&&a[pos]+opr>=0&&a[pos+1]+opr<10&&a[pos+1]+opr>=0);
}

int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	N=read(); scanf("%s",s+1); scanf("%s",t+1);
	for(int i=1;i<=N;i++) a[i]=s[i]-'0',b[i]=t[i]-'0';
	for(int i=1;i<=N;i++) suma[i&1]+=a[i];
	for(int i=1;i<=N;i++) sumb[i&1]+=b[i];
	if(suma[0]-suma[1]!=sumb[0]-sumb[1]){ puts("-1"); return 0; }
	LL ans=abs((sumb[0]+sumb[1])-(suma[0]+suma[1]))/2;
	LL dsum=((sumb[0]+sumb[1])-(suma[0]+suma[1]))/2;
	memcpy(c,a,sizeof(a));
	memcpy(d,b,sizeof(b));
	LL sum=0;
	for(int i=1;i<=N;i++){
		while(a[i]<b[i]&&dsum>0&&Can(i,1)){ --dsum,OP(i,1); }
		while(a[i]>b[i]&&dsum<0&&Can(i,-1)){ ++dsum,OP(i,-1); }
		sum+=a[i]-b[i]; ans+=abs(sum);
	}
	dsum=((sumb[0]+sumb[1])-(suma[0]+suma[1]))/2;
	top=0;
	printf("%lld\n",ans);
	memcpy(a,c,sizeof(a));
	memcpy(b,d,sizeof(b));
	for(int i=1;i<N;i++){
		if(a[i]!=b[i]){
			if(a[i]<b[i]){
				while(a[i]<b[i]){
					if(dsum>0&&Can(i,1)) --dsum,OP(i,1);
					else {
						int pos=-1;
						for(int j=i;j<=N;j+=2)
							if(a[j]>b[j]){ pos=j; break; }
						int ad=i,mn=i+1;
						for(int j=i;j<=pos;j+=2){
							while(Can(ad,1)&&ad<pos) OP(ad,1),ad+=2;
							while(Can(mn,-1)&&mn<pos) OP(mn,-1),mn+=2;
						}
						if(ad==i&&mn==i+1){
							mn=pos-1; ad=pos-2;
							for(int j=i;j<=pos;j+=2){
								while(Can(mn,-1)&&mn>i) OP(mn,-1),mn-=2;
								while(Can(ad,1)&&ad>=i) OP(ad,1),ad-=2;
							}
						}
					} if(top>=MAX) break;
				}
			} else{
				while(a[i]>b[i]){
					if(dsum<0&&Can(i,-1)) ++dsum,OP(i,-1);
					else {
						int pos=-1;
						for(int j=i;j<=N;j+=2)
							if(a[j]<b[j]){ pos=j; break; }
						int mn=i,ad=i+1;
						for(int j=i;j<=pos;j+=2){
							while(Can(mn,-1)&&mn<pos) OP(mn,-1),mn+=2;
							while(Can(ad,1)&&ad<pos) OP(ad,1),ad+=2;
						}
						if(ad==i+1&&mn==i){
							mn=pos-2; ad=pos-1;
							for(int j=i;j<=pos;j+=2){
								while(Can(ad,1)&&ad>i) OP(ad,1),ad-=2;
								while(Can(mn,-1)&&mn>=i) OP(mn,-1),mn-=2;
							}
						}
					} if(top>=MAX) break;
				}
			}
		} if(top>=MAX) break;
	}
	for(int i=1;i<=min(top,MAX);i++){
		printf("%d %d\n",post[i],oprt[i]);
	}
	return 0;
}


#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

#define LL long long
#define fgx cerr<<"--------------"<<endl;
#define dgx cerr<<"=============="<<endl;

inline int read(){
	int x=0,f=1;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*f;
}
const int MAXN = 100010;
const int MAX = 100000;
const int INF = 2147483600;

int a[MAXN+1],b[MAXN+1],c[MAXN+1],d[MAXN+1];
LL suma[2],sumb[2];
int N; char s[MAXN+1],t[MAXN+1];
int post[MAXN+1],oprt[MAXN+1],top;
inline void OP(int pos,int opr){
	a[pos]+=opr; a[pos+1]+=opr;
	post[++top]=pos; oprt[top]=opr;
	return ;
}
inline bool Can(int pos,int opr){
	return (a[pos]+opr<10&&a[pos]+opr>=0&&a[pos+1]+opr<10&&a[pos+1]+opr>=0);
}

int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	N=read(); scanf("%s",s+1); scanf("%s",t+1);
	for(int i=1;i<=N;i++) a[i]=s[i]-'0',b[i]=t[i]-'0';
	for(int i=1;i<=N;i++) suma[i&1]+=a[i];
	for(int i=1;i<=N;i++) sumb[i&1]+=b[i];
	if(suma[0]-suma[1]!=sumb[0]-sumb[1]){ puts("-1"); return 0; }
	LL ans=abs((sumb[0]+sumb[1])-(suma[0]+suma[1]))/2;
	LL dsum=((sumb[0]+sumb[1])-(suma[0]+suma[1]))/2;
	memcpy(c,a,sizeof(a));
	memcpy(d,b,sizeof(b));
	LL sum=0;
	for(int i=1;i<=N;i++){
		while(a[i]<b[i]&&dsum>0){ --dsum,OP(i,1); }
		while(a[i]>b[i]&&dsum<0){ ++dsum,OP(i,-1); }
		sum+=a[i]-b[i]; ans+=abs(sum);
	}
	dsum=((sumb[0]+sumb[1])-(suma[0]+suma[1]))/2;
	top=0;
	printf("%lld\n",ans);
	memcpy(a,c,sizeof(a));
	memcpy(b,d,sizeof(b));
	for(int i=1;i<N;i++){
		if(a[i]!=b[i]){
			if(a[i]<b[i]){
				while(a[i]<b[i]){
					if(dsum>0) --dsum,OP(i,1);
					else {
						int pos=-1;
						for(int j=i;j<=N;j+=2)
							if(a[j]>b[j]){ pos=j; break; }
						int ad=i,mn=i+1;
						for(int j=i;j<=pos;j+=2){
							while(Can(ad,1)&&ad<pos) OP(ad,1),ad+=2;
							while(Can(mn,-1)&&mn<pos) OP(mn,-1),mn+=2;
						}
						if(ad==i&&mn==i+1){
							mn=pos-1; ad=pos-2;
							for(int j=i;j<=pos;j+=2){
								while(Can(mn,-1)&&mn>i) OP(mn,-1),mn-=2;
								while(Can(ad,1)&&ad>=i) OP(ad,1),ad-=2;
							}
						}
					} if(top>=MAX) break;
				}
			} else{
				while(a[i]>b[i]){
					if(dsum<0) ++dsum,OP(i,-1);
					else {
						int pos=-1;
						for(int j=i;j<=N;j+=2)
							if(a[j]<b[j]){ pos=j; break; }
						int mn=i,ad=i+1;
						for(int j=i;j<=pos;j+=2){
							while(Can(mn,-1)&&mn<pos) OP(mn,-1),mn+=2;
							while(Can(ad,1)&&ad<pos) OP(ad,1),ad+=2;
						}
						if(ad==i+1&&mn==i){
							mn=pos-2; ad=pos-1;
							for(int j=i;j<=pos;j+=2){
								while(Can(ad,1)&&ad>i) OP(ad,1),ad-=2;
								while(Can(mn,-1)&&mn>=i) OP(mn,-1),mn-=2;
							}
						}
					} if(top>=MAX) break;
				}
			}
		} if(top>=MAX) break;
	}
	for(int i=1;i<=min(top,MAX);i++){
		printf("%d %d\n",post[i],oprt[i]);
	}
	return 0;
}


#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

#define LL long long
#define fgx cerr<<"--------------"<<endl;
#define dgx cerr<<"=============="<<endl;

inline int read(){
	int x=0,f=1;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*f;
}
const int MAXN = 100010;
const int MAX = 100000;
const int INF = 2147483600;

int a[MAXN+1],b[MAXN+1],c[MAXN+1],d[MAXN+1];
LL suma[2],sumb[2];
int N; char s[MAXN+1],t[MAXN+1];
int post[MAXN+1],oprt[MAXN+1],top;
inline void OP(int pos,int opr){
	a[pos]+=opr; a[pos+1]+=opr;
	if(top<MAX){ post[++top]=pos; oprt[top]=opr; }
	return ;
}
inline bool Can(int pos,int opr){
	return ((a[pos]+opr<10&&a[pos]+opr>=0&&a[pos+1]+opr<10&&a[pos+1]+opr>=0)&&pos<N);
}

int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	N=read(); scanf("%s",s+1); scanf("%s",t+1);
	for(int i=1;i<=N;i++) a[i]=s[i]-'0',b[i]=t[i]-'0';
	for(int i=1;i<=N;i++) suma[i&1]+=a[i];
	for(int i=1;i<=N;i++) sumb[i&1]+=b[i];
	if(suma[0]-suma[1]!=sumb[0]-sumb[1]){ puts("-1"); return 0; }
	LL ans=0;
	LL dsum=((sumb[0]+sumb[1])-(suma[0]+suma[1]))/2;
	memcpy(c,a,sizeof(a));
	memcpy(d,b,sizeof(b));
	LL sum=0; //sum[0]=sum[1]=0;
	for(int i=1;i<=N;i++){
		sum=-sum+b[i]-a[i];
		ans+=abs(sum);
	}
	dsum=((sumb[0]+sumb[1])-(suma[0]+suma[1]))/2;
	top=0;
	printf("%lld\n",ans);
	memcpy(a,c,sizeof(a));
	memcpy(b,d,sizeof(b));
	for(int i=1;i<N;i++){
		if(a[i]!=b[i]){
			if(a[i]<b[i]){
				while(a[i]<b[i]){
					if(dsum>0&&Can(i,1)) --dsum,OP(i,1);
					else {
						int pos=-1;
						for(int j=i;j<=N;j+=2)
							if(a[j]>b[j]){ pos=j; break; }
						int ad=i,mn=i+1;
						for(int j=i;j<=pos;j+=2){
							while(Can(ad,1)&&ad<pos) OP(ad,1),ad+=2;
							while(Can(mn,-1)&&mn<pos) OP(mn,-1),mn+=2;
						}
						if(ad==i&&mn==i+1){
							mn=pos-1; ad=pos-2;
							for(int j=i;j<=pos;j+=2){
								while(Can(mn,-1)&&mn>i) OP(mn,-1),mn-=2;
								while(Can(ad,1)&&ad>=i) OP(ad,1),ad-=2;
							}
						}
					} if(top>=MAX) break;
				}
			} else{
				while(a[i]>b[i]){
					if(dsum<0&&Can(i,-1)) ++dsum,OP(i,-1);
					else {
						int pos=-1;
						for(int j=i;j<=N;j+=2)
							if(a[j]<b[j]){ pos=j; break; }
						int mn=i,ad=i+1;
						for(int j=i;j<=pos;j+=2){
							while(Can(mn,-1)&&mn<pos) OP(mn,-1),mn+=2;
							while(Can(ad,1)&&ad<pos) OP(ad,1),ad+=2;
						}
						if(ad==i+1&&mn==i){
							mn=pos-2; ad=pos-1;
							for(int j=i;j<=pos;j+=2){
								while(Can(ad,1)&&ad>i) OP(ad,1),ad-=2;
								while(Can(mn,-1)&&mn>=i) OP(mn,-1),mn-=2;
							}
						}
					} if(top>=MAX) break;
				}
			}
		} if(top>=MAX) break;
	}
	for(int i=1;i<=min(top,MAX);i++){
		printf("%d %d\n",post[i],oprt[i]);
	}
	return 0;
}


#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

#define LL long long
#define fgx cerr<<"--------------"<<endl;
#define dgx cerr<<"=============="<<endl;

inline int read(){
	int x=0,f=1;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*f;
}
const int MAXN = 100010;
const int MAX = 100000;
const int INF = 2147483600;

int a[MAXN+1],b[MAXN+1],c[MAXN+1],d[MAXN+1];
LL suma[2],sumb[2];
int N; char s[MAXN+1],t[MAXN+1];
int post[MAXN+1],oprt[MAXN+1],top;
inline void OP(int pos,int opr){
	a[pos]+=opr; a[pos+1]+=opr;
	post[++top]=pos; oprt[top]=opr;
	return ;
}
inline bool Can(int pos,int opr){
	return ((a[pos]+opr<10&&a[pos]+opr>=0&&a[pos+1]+opr<10&&a[pos+1]+opr>=0)&&pos<N);
}

int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	N=read(); scanf("%s",s+1); scanf("%s",t+1);
	for(int i=1;i<=N;i++) a[i]=s[i]-'0',b[i]=t[i]-'0';
	for(int i=1;i<=N;i++) suma[i&1]+=a[i];
	for(int i=1;i<=N;i++) sumb[i&1]+=b[i];
	if(suma[0]-suma[1]!=sumb[0]-sumb[1]){ puts("-1"); return 0; }
	LL ans=0;
	LL dsum=((sumb[0]+sumb[1])-(suma[0]+suma[1]))/2;
	memcpy(c,a,sizeof(a));
	memcpy(d,b,sizeof(b));
	LL sum=0; //sum[0]=sum[1]=0;
	for(int i=1;i<=N;i++){
		sum=-sum+b[i]-a[i];
		ans+=abs(sum);
	}
	dsum=((sumb[0]+sumb[1])-(suma[0]+suma[1]))/2;
	top=0;
	printf("%lld\n",ans);
	memcpy(a,c,sizeof(a));
	memcpy(b,d,sizeof(b));
	for(int i=1;i<N;i++){
		if(a[i]!=b[i]){
			if(a[i]<b[i]){
				while(a[i]<b[i]){
					if(dsum>0&&Can(i,1)) --dsum,OP(i,1);
					else {
						int pos=-1;
						for(int j=i;j<=N;j+=2)
							if(a[j]>b[j]){ pos=j; break; }
						int ad=i,mn=i+1;
						for(int j=i;j<=pos;j+=2){
							while(Can(ad,1)&&ad<pos) OP(ad,1),ad+=2;
							while(Can(mn,-1)&&mn<pos) OP(mn,-1),mn+=2;
						}
						if(ad==i&&mn==i+1){
							mn=pos-1; ad=pos-2;
							for(int j=i;j<=pos;j+=2){
								while(Can(mn,-1)&&mn>i) OP(mn,-1),mn-=2;
								while(Can(ad,1)&&ad>=i) OP(ad,1),ad-=2;
							}
						}
					} if(top>=MAX) break;
				}
			} else{
				while(a[i]>b[i]){
					if(dsum<0&&Can(i,-1)) ++dsum,OP(i,-1);
					else {
						int pos=-1;
						for(int j=i;j<=N;j+=2)
							if(a[j]<b[j]){ pos=j; break; }
						int mn=i,ad=i+1;
						for(int j=i;j<=pos;j+=2){
							while(Can(mn,-1)&&mn<pos) OP(mn,-1),mn+=2;
							while(Can(ad,1)&&ad<pos) OP(ad,1),ad+=2;
						}
						if(ad==i+1&&mn==i){
							mn=pos-2; ad=pos-1;
							for(int j=i;j<=pos;j+=2){
								while(Can(ad,1)&&ad>i) OP(ad,1),ad-=2;
								while(Can(mn,-1)&&mn>=i) OP(mn,-1),mn-=2;
							}
						}
					} if(top>=MAX) break;
				}
			}
		} if(top>=MAX) break;
	}
	for(int i=1;i<=min(top,MAX);i++){
		printf("%d %d\n",post[i],oprt[i]);
	}
	return 0;
}


#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

#define LL long long
#define fgx cerr<<"--------------"<<endl;
#define dgx cerr<<"=============="<<endl;

inline int read(){
	int x=0,f=1;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*f;
}
const int MAXN = 100010;
const int MAX = 100000;
const int INF = 2147483600;

int a[MAXN+1],b[MAXN+1],c[MAXN+1],d[MAXN+1];
LL suma[2],sumb[2];
int N; char s[MAXN+1],t[MAXN+1];
int post[MAXN+1],oprt[MAXN+1],top;
inline void OP(int pos,int opr){
	a[pos]+=opr; a[pos+1]+=opr;
	if(top<MAX){ post[++top]=pos; oprt[top]=opr; }
	return ;
}
inline bool Can(int pos,int opr){
	return ((a[pos]+opr<10&&a[pos]+opr>=0&&a[pos+1]+opr<10&&a[pos+1]+opr>=0)&&pos<N);
}
int f[MAXN+1];
inline int val(int x){
	return (x<0?-1:1);
}
inline void dfs(int k){
	if(!f[k]) return ;
	//cout<<"yes:"<<k<<" "<<f[k]<<" "<<Can(k,val(f[k]))<<" "<<val(f[k])<<" "<<a[1]<<" "<<a[2]<<endl;
	if(top>=MAX) return ; bool flag=0;
	while(f[k]&&Can(k,val(f[k]))) OP(k,val(f[k])),f[k]-=val(f[k]),flag=1;
	if(!flag) return ; dfs(k-1); dfs(k+1); return ;
}

int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	N=read(); scanf("%s",s+1); scanf("%s",t+1);
	for(int i=1;i<=N;i++) a[i]=s[i]-'0',b[i]=t[i]-'0';
	for(int i=1;i<=N;i++) suma[i&1]+=a[i];
	for(int i=1;i<=N;i++) sumb[i&1]+=b[i];
	if(suma[0]-suma[1]!=sumb[0]-sumb[1]){ puts("-1"); return 0; }
	LL ans=0;
	LL dsum=((sumb[0]+sumb[1])-(suma[0]+suma[1]))/2;
	memcpy(c,a,sizeof(a));
	memcpy(d,b,sizeof(b));
	LL sum=0; //sum[0]=sum[1]=0;
	for(int i=1;i<=N;i++){
		f[i-1]=sum;
		sum=-sum+b[i]-a[i];
		ans+=abs(sum);
	}
	dsum=((sumb[0]+sumb[1])-(suma[0]+suma[1]))/2;
	top=0;
	printf("%lld\n",ans);
	memcpy(a,c,sizeof(a));
	memcpy(b,d,sizeof(b));
	for(int i=1;i<N;i++) dfs(i);
	for(int i=1;i<=min(top,MAX);i++){
		printf("%d %d\n",post[i],oprt[i]);
	}
	return 0;
}


#include <bits/stdc++.h>
const int N=100005;
int n,a[N],b[N],c[N];
long long ans;
char s1[N],s2[N];
int main(){
	scanf("%d",&n);
	scanf("%s",s1+1);
	scanf("%s",s2+1);
	for (int i=1;i<=n;i++) a[i]=s1[i]-'0',b[i]=s2[i]-'0';
	for (int i=1;i<=n;i++) c[i]=b[i]-a[i]-c[i-1];
	if (c[n]){
		puts("-1");
		return 0;
	}
	for (int i=1;i<=n;i++) ans=ans+abs(c[i]);
	printf("%lld\n",ans);
	ans=std::min(ans,100000ll);
	int p=1,now=0;
	while (ans--){
		while (!c[p]) p++;
		if (now<p) now=p;
		while ((a[now+1]==9 && c[now]>0) || (a[now+1]==0 && c[now]<0)) now++;
		int opt=c[now]>0?1:-1;
		printf("%d %d\n",now,opt);
		c[now]-=opt,a[now]+=opt,a[now+1]+=opt;
		now--;
	}
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include<map>
#include<vector>
using namespace std;
const int maxn=1e5+7;
int n;
int a[maxn];
int b[maxn];
int c[maxn];
char ch[maxn];
long long ans;
void init(int *a)
{
    scanf("%s",ch+1);
    for(int i=1;i<=n;i++)
        a[i]=ch[i]-'0';
}
//void dfs(int x,int w)
//{
//    if(!ans)
//        return;
//    if(0<=a[x+1]+w&&a[x+1]+w<=9)
//    {
//        a[x]+=w;
//        a[x+1]+=w;
//        ans--;
//        printf("%d %d\n",x,w);
//        return ;
//    }
//    dfs(x+1,-w);
//    if(!ans)
//        return;
//    printf("%d %d\n",x,w);
//    a[x]+=w;
//    a[x+1]+=w;
//    ans--;
//}
void dfs(int x,int w)
{
	if(!ans)return;
	if(0<=a[x+1]+w&&a[x+1]+w<=9){printf("%d %d\n",x,w);a[x]+=w,a[x+1]+=w;--ans;return;}
	dfs(x+1,-w);if(!ans)return;printf("%d %d\n",x,w);a[x]+=w;a[x+1]+=w;--ans;
}
int main()
{
    scanf("%d",&n);
    init(a);
    init(b);
    ans=0;
    for(int i=1;i<=n;i++)
    {
        c[i]=a[i];
    }
    for(int i=1;i<n;i++)
    {
        int d=b[i]-c[i];
        c[i]+=d;
        c[i+1]+=d;
        if(d<0)d=-d;
        ans+=d;
    }

    if(c[n]!=b[n])
        printf("-1\n");
    else
    {
        printf("%I64d\n",ans);
        ans=min(ans,10000011ll);
        for(int i=1;i<n&&ans>0;i++)
        {
            while(a[i]!=b[i]&&ans>0)
            {
                dfs(i,(b[i]-a[i])/abs(b[i]-a[i]));
            }
        }
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include<map>
#include<vector>
using namespace std;
const int maxn=1e5+7;
int n;
int a[maxn];
int b[maxn];
int c[maxn];
char ch[maxn];
long long ans;
void init(int *a)
{
    scanf("%s",ch+1);
    for(int i=1;i<=n;i++)
        a[i]=ch[i]-'0';
}
void dfs(int x,int w)
{
    if(!ans)
        return;
    if(0<=a[x+1]+w&&a[x+1]+w<=9)
    {
        a[x]+=w;
        a[x+1]+=w;
        ans--;
        printf("%d %d\n",x,w);
        return ;
    }
    dfs(x+1,-w);
    if(!ans)
        return;
    printf("%d %d\n",x,w);
    a[x]+=w;
    a[x+1]+=w;
    ans--;
}

int main()
{
    scanf("%d",&n);
    init(a);
    init(b);
    ans=0;
    for(int i=1;i<=n;i++)
    {
        c[i]=a[i];
    }
    for(int i=1;i<n;i++)
    {
        int d=b[i]-c[i];
        c[i]+=d;
        c[i+1]+=d;
        if(d<0)d=-d;
        ans+=d;
    }

    if(c[n]!=b[n])
        printf("-1\n");
    else
    {
        printf("%I64d\n",ans);
       // ans=min(ans,100000ll);
		for(int i=1;i<n&&ans>0;i++)
        {
            while(a[i]!=b[i]&&ans>0)
            {
                dfs(i,(b[i]-a[i])/abs(b[i]-a[i]));
            }
        }
    }

    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include<map>
#include<vector>
using namespace std;
const int maxn=1e5+7;
int n;
int a[maxn];
int b[maxn];
int c[maxn];
char ch[maxn];
long long ans;
void init(int *a)
{
    scanf("%s",ch+1);
    for(int i=1;i<=n;i++)
        a[i]=ch[i]-'0';
}
void dfs(int x,int w)
{
    if(!ans)
        return;
    if(0<=a[x+1]+w&&a[x+1]+w<=9)
    {
        a[x]+=w;
        a[x+1]+=w;
        ans--;
        printf("%d %d\n",x,w);
        return ;
    }
    dfs(x+1,-w);
    if(!ans)
        return;
    printf("%d %d\n",x,w);
    a[x]+=w;
    a[x+1]+=w;
    ans--;
}
int main()
{
    scanf("%d",&n);
    init(a);
    init(b);
    ans=0;
    for(int i=1;i<=n;i++)
    {
        c[i]=a[i];
    }
    for(int i=1;i<n;i++)
    {
        int d=b[i]-c[i];
        c[i]+=d;
        c[i+1]+=d;
        if(d<0)d=-d;
        ans+=d;
    }

    if(c[n]!=b[n])
        printf("-1\n");
    else
    {
        printf("%lld\n",ans);
        ans=min(ans,10000011);
        for(int i=1;i<n&&ans>0;i++)
        {
            while(a[i]!=b[i]&&ans>0)
            {
                dfs(i,(b[i]-a[i])/abs(b[i]-a[i]));
            }
        }
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include<map>
#include<vector>
using namespace std;
const int maxn=1e5+7;
int n;
int a[maxn];
int b[maxn];
int c[maxn];
char ch[maxn];
long long ans;
void init(int *a)
{
    scanf("%s",ch+1);
    for(int i=1;i<=n;i++)
        a[i]=ch[i]-'0';
}
void dfs(int x,int w)
{
    if(!ans)
        return;
    if(0<=a[x+1]+w&&a[x+1]+w<=9)
    {
        a[x]+=w;
        a[x+1]+=w;
        ans--;
        printf("%d %d\n",x,w);
        return ;
    }
    dfs(x+1,-w);
    if(!ans)
        return;
    printf("%d %d\n",x,w);
    a[x]+=w;
    a[x+1]+=w;
    ans--;
}

int main()
{
//    scanf("%d",&n);
//    init(a);
//    init(b);
//    ans=0;
//    for(int i=1;i<=n;i++)
//    {
//        c[i]=a[i];
//    }
//    for(int i=1;i<n;i++)
//    {
//        int d=b[i]-c[i];
//        c[i]+=d;
//        c[i+1]+=d;
//        if(d<0)d=-d;
//        ans+=d;
//    }
//
//    if(c[n]!=b[n])
//        printf("-1\n");
//    else
//    {
//        printf("%I64d\n",ans);
//        ans=min(ans,10000011ll);
//        for(int i=1;i<n&&ans>0;i++)
//        {
//            while(a[i]!=b[i]&&ans>0)
//            {
//                dfs(i,(b[i]-a[i])/abs(b[i]-a[i]));
//            }
//        }
//    }
scanf("%d",&n);init(a);init(b);
	for(int i=1;i<=n;++i)c[i]=a[i];
	for(int i=1;i<n;++i){int d=b[i]-c[i];c[i]+=d;c[i+1]+=d;ans+=abs(d);}
	if(c[n]!=b[n]){puts("-1");return 0;}
	cout<<ans<<endl;ans=min(ans,100000ll);
	for(int i=1;i<n&&ans>0;++i)
		while(a[i]!=b[i]&&ans>0)dfs(i,(b[i]-a[i])/abs(b[i]-a[i]));
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include<map>
#include<vector>
using namespace std;
const int maxn=1e5+7;
int n;
int a[maxn];
int b[maxn];
int c[maxn];
char ch[maxn];
long long ans;
void init(int *a)
{
    scanf("%s",ch+1);
    for(int i=1;i<=n;i++)
        a[i]=ch[i]-'0';
}
void dfs(int x,int w)
{
    if(!ans)
        return;
    if(0<=a[x+1]+w&&a[x+1]+w<=9)
    {
        a[x]+=w;
        a[x+1]+=w;
        ans--;
        printf("%d %d\n",x,w);
        return ;
    }
    dfs(x+1,-w);
    if(!ans)
        return;
    printf("%d %d\n",x,w);
    a[x]+=w;
    a[x+1]+=w;
    ans--;
}

int main()
{
    scanf("%d",&n);
    init(a);
    init(b);
    ans=0;
    for(int i=1;i<=n;i++)
    {
        c[i]=a[i];
    }
    for(int i=1;i<n;i++)
    {
        int d=b[i]-c[i];
        c[i]+=d;
        c[i+1]+=d;
        if(d<0)d=-d;
        ans+=d;
    }

    if(c[n]!=b[n])
        printf("-1\n");
//    else
//    {
//        printf("%I64d\n",ans);
//        ans=min(ans,10000011ll);
//        for(int i=1;i<n&&ans>0;i++)
//        {
//            while(a[i]!=b[i]&&ans>0)
//            {
//                dfs(i,(b[i]-a[i])/abs(b[i]-a[i]));
//            }
//        }
//    }
    else
    {
        cout<<ans<<endl;ans=min(ans,100000ll);
	for(int i=1;i<n&&ans>0;++i)
		while(a[i]!=b[i]&&ans>0)dfs(i,(b[i]-a[i])/abs(b[i]-a[i]));
    }

    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include<map>
#include<vector>
using namespace std;
const int maxn=1e5+7;
int n;
int a[maxn];
int b[maxn];
int c[maxn];
char ch[maxn];
long long ans;
void init(int *a)
{
    scanf("%s",ch+1);
    for(int i=1;i<=n;i++)
        a[i]=ch[i]-'0';
}
void dfs(int x,int w)
{
    if(!ans)
        return;
    if(0<=a[x+1]+w&&a[x+1]+w<=9)
    {
        a[x]+=w;
        a[x+1]+=w;
        ans--;
        printf("%d %d\n",x,w);
        return ;
    }
    dfs(x+1,-w);
    if(!ans)
        return;
    printf("%d %d\n",x,w);
    a[x]+=w;
    a[x+1]+=w;
    ans--;
}

int main()
{
    scanf("%d",&n);
    init(a);
    init(b);
    ans=0;
    for(int i=1;i<=n;i++)
    {
        c[i]=a[i];
    }
    for(int i=1;i<n;i++)
    {
        int d=b[i]-c[i];
        c[i]+=d;
        c[i+1]+=d;
        if(d<0)d=-d;
        ans+=d;
    }

    if(c[n]!=b[n])
        printf("-1\n");
//    else
//    {
//        printf("%I64d\n",ans);
//        ans=min(ans,10000011ll);
//
//    }
    else
    {
        cout<<ans<<endl;ans=min(ans,100000ll);
//	for(int i=1;i<n&&ans>0;++i)
//		while(a[i]!=b[i]&&ans>0)dfs(i,(b[i]-a[i])/abs(b[i]-a[i]));
		for(int i=1;i<n&&ans>0;i++)
        {
            while(a[i]!=b[i]&&ans>0)
            {
                dfs(i,(b[i]-a[i])/abs(b[i]-a[i]));
            }
        }
    }

    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include<map>
#include<vector>
using namespace std;
const int maxn=1e5+7;
int n;
int a[maxn];
int b[maxn];
int c[maxn];
char ch[maxn];
int ans;
void init(int *a)
{
    scanf("%s",ch+1);
    for(int i=1;i<=n;i++)
        a[i]=ch[i]-'0';
}
void dfs(int x,int w)
{
    if(!ans)
        return;
    if(0<=a[x+1]+w&&a[x+1]+w<=9)
    {
        a[x]+=w;
        a[x+1]+=w;
        ans--;
        printf("%d %d\n",x,w);
        return ;
    }
    dfs(x+1,-w);
    if(!ans)
        return;
    printf("%d %d\n",x,w);
    a[x]+=w;
    a[x+1]+=w;
    ans--;
}
int main()
{
    scanf("%d",&n);
    init(a);
    init(b);
    ans=0;
    for(int i=1;i<=n;i++)
    {
        c[i]=a[i];
    }
    for(int i=1;i<n;i++)
    {
        int d=b[i]-c[i];
        c[i]+=d;
        c[i+1]+=d;
        if(d<0)d=-d;
        ans+=d;
    }

    if(c[n]!=b[n])
        printf("-1\n");
    else
    {
        printf("%d\n",ans);
        for(int i=1;i<n&&ans>0;i++)
        {
            while(a[i]!=b[i]&&ans>0)
            {
                dfs(i,(b[i]-a[i])/abs(b[i]-a[i]));
            }
        }
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include<map>
#include<vector>
using namespace std;
const int maxn=1e5+7;
int n;
char a[maxn];
char b[maxn];
int aa[maxn];
int bb[maxn];
int main()
{
    scanf("%d%s%s",&n,a,b);
    for(int i=0; i<n; i++)
    {
        aa[i]=a[i]-'0';
        bb[i]=b[i]-'0';
    }
    bool flag=false;
    int ans=0;
    for(int i=0; i<n-1; i++)
    {
        if(aa[i]==bb[i])
            continue;
        else if(bb[i]>aa[i])
        {
            ans+=bb[i]-aa[i];
            if(aa[i+1]+bb[i]-aa[i]>9)
            {
                flag=true;
                break;
            }
             aa[i+1]=aa[i+1]+(bb[i]-aa[i]);
            aa[i]=bb[i];
        }
        else
        {

            ans+=aa[i]-bb[i];
            if(aa[i+1]+bb[i]-aa[i]<0)
            {
                flag=true;
                break;
            }
              aa[i+1]=aa[i+1]+(bb[i]-aa[i]);
            aa[i]=bb[i];
        }
    }

    if(flag)
    {
        printf("-1\n");
    }
    else
    {
        if(aa[n-1]!=bb[n-1])
            printf("-1\n");
        else
            printf("%d\n",ans);
    }
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include<map>
#include<vector>
using namespace std;
const int maxn=1e5+7;
int n;
int a[maxn];
int b[maxn];
int c[maxn];
char ch[maxn];
long long ans;
void init(int *a)
{
    scanf("%s",ch+1);
    for(int i=1;i<=n;i++)
        a[i]=ch[i]-'0';
}
void dfs(int x,int w)
{
    if(!ans)
        return;
    if(0<=a[x+1]+w&&a[x+1]+w<=9)
    {
        a[x]+=w;
        a[x+1]+=w;
        ans--;
        printf("%d %d\n",x,w);
        return ;
    }
    dfs(x+1,-w);
    if(!ans)
        return;
    printf("%d %d\n",x,w);
    a[x]+=w;
    a[x+1]+=w;
    ans--;
}
int main()
{
    scanf("%d",&n);
    init(a);
    init(b);
    ans=0;
    for(int i=1;i<=n;i++)
    {
        c[i]=a[i];
    }
    for(int i=1;i<n;i++)
    {
        int d=b[i]-c[i];
        c[i]+=d;
        c[i+1]+=d;
        if(d<0)d=-d;
        ans+=d;
    }

    if(c[n]!=b[n])
        printf("-1\n");
    else
    {
        printf("%I64d\n",ans);
        ans=min(ans,10000011ll);
        for(int i=1;i<n&&ans>0;i++)
        {
            while(a[i]!=b[i]&&ans>0)
            {
                dfs(i,(b[i]-a[i])/abs(b[i]-a[i]));
            }
        }
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include<map>
#include<vector>
using namespace std;
const int maxn=1e5+7;
int n;
int a[maxn];
int b[maxn];
int c[maxn];
char ch[maxn];
long long ans;
void init(int *a)
{
    scanf("%s",ch+1);
    for(int i=1;i<=n;i++)
        a[i]=ch[i]-'0';
}
void dfs(int x,int w)
{
    if(!ans)
        return;
    if(0<=a[x+1]+w&&a[x+1]+w<=9)
    {
        a[x]+=w;
        a[x+1]+=w;
        ans--;
        printf("%d %d\n",x,w);
        return ;
    }
    dfs(x+1,-w);
    if(!ans)
        return;
    printf("%d %d\n",x,w);
    a[x]+=w;
    a[x+1]+=w;
    ans--;
}

int main()
{
    scanf("%d",&n);
    init(a);
    init(b);
    ans=0;
    for(int i=1;i<=n;i++)
    {
        c[i]=a[i];
    }
    for(int i=1;i<n;i++)
    {
        int d=b[i]-c[i];
        c[i]+=d;
        c[i+1]+=d;
        if(d<0)d=-d;
        ans+=d;
    }

    if(c[n]!=b[n])
        printf("-1\n");
//    else
//    {
//        printf("%I64d\n",ans);
//        ans=min(ans,10000011ll);
//
//    }
    else
    {
        printf("%I64d\n",ans);
        ans=min(ans,100000ll);
		for(int i=1;i<n&&ans>0;i++)
        {
            while(a[i]!=b[i]&&ans>0)
            {
                dfs(i,(b[i]-a[i])/abs(b[i]-a[i]));
            }
        }
    }

    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include<map>
#include<vector>
using namespace std;
const int maxn=1e5+7;
int n;
char a[maxn];
char b[maxn];
int aa[maxn];
int bb[maxn];
int anns[10*maxn];
int ABS(int a)
{
    if(a<0)
        return -a;
    return a;
}
int main()
{
    scanf("%d%s%s",&n,a,b);
    for(int i=0; i<n; i++)
    {
        aa[i]=a[i]-'0';
        bb[i]=b[i]-'0';
    }
    bool flag=false;
    int ans=0;
    memset(anns,0,sizeof(anns));
    for(int i=0; i<n-1; i++)
    {
        if(aa[i]==bb[i])
            continue;
        else if(bb[i]>aa[i])
        {
            ans+=bb[i]-aa[i];
            anns[i]=bb[i]-aa[i];
            if(aa[i+1]+bb[i]-aa[i]>9)
            {
                flag=true;
                break;
            }
            aa[i+1]=aa[i+1]+(bb[i]-aa[i]);
            aa[i]=bb[i];
        }
        else
        {

            ans+=aa[i]-bb[i];
            anns[i]=bb[i]-aa[i];
            if(aa[i+1]+bb[i]-aa[i]<0)
            {
                flag=true;
                break;
            }
            aa[i+1]=aa[i+1]+(bb[i]-aa[i]);
            aa[i]=bb[i];
        }
    }

    if(flag)
    {
        printf("-1\n");
    }
    else
    {
        if(aa[n-1]!=bb[n-1])
            printf("-1\n");
        else
        {
            printf("%d\n",ans);
            int num=1;
            for(int i=0; i<n-1; i++)
            {
                if(anns[i]!=0)
                {
                    for(int j=1; j<=ABS(anns[i]); j++)
                    {
                        printf("%d ",i+1);
                        if(anns[i]>0)
                            printf("1\n");
                        else
                            printf("-1\n");

                    }
                }
            }
        }

    }
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include<map>
#include<vector>
using namespace std;
const int maxn=1e5+7;
int n;
char a[maxn];
char b[maxn];
int aa[maxn];
int bb[maxn];
int cc[maxn];
int ABS(int a)
{
    if(a<0)
        return -a;
    return a;
}
int main()
{
    scanf("%d%s%s",&n,a,b);
    for(int i=0; i<n; i++)
    {
        aa[i]=a[i]-'0';
        cc[i]=aa[i];
        bb[i]=b[i]-'0';
    }
    long long ans=0;
    for(int i=0;i<n-1;i++)
    {
        int d=bb[i]-cc[i];
        cc[i]+=d;
        cc[i+1]+=d;
        ans+=ABS(d);
    }
    if(cc[n-1]!=bb[n-1])
    {
        printf("-1\n");
    }
    else
    {
        printf("%I64d\n",ans);
        int tot=0;
        int w;
        for(int i=0;i<n-1;i++)
        {
            int d=bb[i]-aa[i];
            if(aa[i+1]+d<0||aa[i+1]+d>9)continue;
            if(d<0)w=-1;
            else w=1;
            tot+=d;
            int t=min(d,100000-tot);
            for(int j=0;j<t;j++)
                printf("%d %d\n",i+1,w);
        }
    }
}


#include <sstream>
#include <fstream>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <utility>
#include <cassert>
#include <bitset>
using namespace std;
#define REP(I,N) for (I=0;I<N;I++)
#define rREP(I,N) for (I=N-1;I>=0;I--)
#define rep(I,S,N) for (I=S;I<N;I++)
#define rrep(I,S,N) for (I=N-1;I>=S;I--)
#define FOR(I,S,N) for (I=S;I<=N;I++)
#define rFOR(I,S,N) for (I=N;I>=S;I--)

#define DEBUG
#ifdef DEBUG
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define deputs(str) fprintf(stderr, "%s\n",str)
#else
#define debug(...)
#define deputs(str)
#endif // DEBUG
typedef unsigned long long ULL;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef long long LL;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF=0x3f3f3f3f;
const LL INFF=0x3f3f3f3f3f3f3f3fll;
const LL M=1e9+7;
const LL maxn=4e5+107;
const double pi=acos(-1.0);
const double eps=0.0000000001;
LL gcd(LL a, LL b) {return b?gcd(b,a%b):a;}
template<typename T>inline void pr2(T x,int k=64) {ll i; REP(i,k) debug("%d",(x>>i)&1); putchar(' ');}
template<typename T>inline void add_(T &A,int B,ll MOD=M) {A+=B; (A>=MOD) &&(A-=MOD);}
template<typename T>inline void mul_(T &A,ll B,ll MOD=M) {A=(A*B)%MOD;}
template<typename T>inline void mod_(T &A,ll MOD=M) {A%=MOD; A+=MOD; A%=MOD;}
template<typename T>inline void max_(T &A,T B) {(A<B) &&(A=B);}
template<typename T>inline void min_(T &A,T B) {(A>B) &&(A=B);}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<typename T>inline T powMM(T a, T b) {
	T ret=1;
	for (; b; b>>=1ll,a=(LL)a*a%M)
		if (b&1) ret=(LL)ret*a%M;
	return ret;
}
int startTime;
void startTimer() {startTime=clock();}
void printTimer() {debug("/--- Time: %ld milliseconds ---/\n",clock()-startTime);}

int a[maxn],b[maxn],c[maxn];
//差分后相当
int value[maxn];//count
ll all=0;
queue<pair<int,int> > Q;
int main() {
	int n,i,j;
	scanf("%d",&n);
	FOR(i,1,n) scanf("%1d",&a[i]),c[i]=a[i];
	FOR(i,1,n) scanf("%1d",&b[i]);
	FOR(i,1,n-1) {
		if (c[i]!=b[i]) {
			if (c[i]<b[i]) {
				REP(j,min(20,b[i]-c[i])) Q.push(make_pair(i,1));
				all+=b[i]-c[i];
				// printf("%d :+ %d\n",i,b[i]-c[i]);
				c[i+1]+=b[i]-c[i]; c[i]+=b[i]-c[i];
			} else {//c[i]>b[i]
				REP(j,min(20,c[i]-b[i])) Q.push(make_pair(i,-1));
				// printf("%d :- %d\n",i,c[i]-b[i]);
				all+=c[i]-b[i];
				c[i+1]-=c[i]-b[i]; c[i]-=c[i]-b[i];
			}
		}
	}
	if (c[n]!=b[n]) return 0*puts("-1");
	else {
		int c=1e5;
		printf("%lld\n",all);
		while (Q.size()) {
			auto now=Q.front(); Q.pop();
			if (0+(now.first==1)<=a[now.first]+now.second&&a[now.first]+now.second<=9&&
				0<=a[now.first+1]+now.second&&a[now.first+1]+now.second<=9){
				a[now.first]+=now.second; a[now.first+1]+=now.second;
			} else Q.push(now);
			printf("%d %d\n",now.first,now.second);
			c--; if (!c) return 0;
		}
	}
}
/*
3
850
102
*/


#include <sstream>
#include <fstream>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <utility>
#include <cassert>
#include <bitset>
using namespace std;
#define REP(I,N) for (I=0;I<N;I++)
#define rREP(I,N) for (I=N-1;I>=0;I--)
#define rep(I,S,N) for (I=S;I<N;I++)
#define rrep(I,S,N) for (I=N-1;I>=S;I--)
#define FOR(I,S,N) for (I=S;I<=N;I++)
#define rFOR(I,S,N) for (I=N;I>=S;I--)

#define DEBUG
#ifdef DEBUG
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define deputs(str) fprintf(stderr, "%s\n",str)
#else
#define debug(...)
#define deputs(str)
#endif // DEBUG
typedef unsigned long long ULL;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef long long LL;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF=0x3f3f3f3f;
const LL INFF=0x3f3f3f3f3f3f3f3fll;
const LL M=1e9+7;
const LL maxn=4e5+107;
const double pi=acos(-1.0);
const double eps=0.0000000001;
LL gcd(LL a, LL b) {return b?gcd(b,a%b):a;}
template<typename T>inline void pr2(T x,int k=64) {ll i; REP(i,k) debug("%d",(x>>i)&1); putchar(' ');}
template<typename T>inline void add_(T &A,int B,ll MOD=M) {A+=B; (A>=MOD) &&(A-=MOD);}
template<typename T>inline void mul_(T &A,ll B,ll MOD=M) {A=(A*B)%MOD;}
template<typename T>inline void mod_(T &A,ll MOD=M) {A%=MOD; A+=MOD; A%=MOD;}
template<typename T>inline void max_(T &A,T B) {(A<B) &&(A=B);}
template<typename T>inline void min_(T &A,T B) {(A>B) &&(A=B);}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<typename T>inline T powMM(T a, T b) {
	T ret=1;
	for (; b; b>>=1ll,a=(LL)a*a%M)
		if (b&1) ret=(LL)ret*a%M;
	return ret;
}
int startTime;
void startTimer() {startTime=clock();}
void printTimer() {debug("/--- Time: %ld milliseconds ---/\n",clock()-startTime);}

int a[maxn],b[maxn],c[maxn];
//差分后相当
int value[maxn];//count
ll all=0;
queue<pair<int,int> > Q;
int main() {
	int n,i,j;
	scanf("%d",&n);
	FOR(i,1,n) scanf("%1d",&a[i]),c[i]=a[i];
	FOR(i,1,n) scanf("%1d",&b[i]);
	FOR(i,1,n-1) {
		if (c[i]!=b[i]) {
			if (c[i]<b[i]) {
				REP(j,min(10,b[i]-c[i])) Q.push(make_pair(i,1));
				all+=b[i]-c[i];
				// printf("%d :+ %d\n",i,b[i]-c[i]);
				c[i+1]+=b[i]-c[i]; c[i]+=b[i]-c[i];
			} else {
				REP(j,min(10,c[i]-b[i])) Q.push(make_pair(i,-1));
				// printf("%d :- %d\n",i,c[i]-b[i]);
				all+=c[i]-b[i];
				c[i+1]-=c[i]-b[i]; c[i]-=c[i]-b[i];
			}
		}
	}
	if (c[n]!=b[n]) return 0*puts("-1");
	else {
		int c=1e5;
		printf("%lld\n",all);
		while (Q.size()) {
			auto now=Q.front(); Q.pop();
			if (0<=a[now.first]+now.second&&a[now.first]+now.second<=9&&
				0<=a[now.first+1]+now.second&&a[now.first+1]+now.second<=9){
				a[now.first]+=now.second; a[now.first+1]+=now.second;
			} else Q.push(now);
			printf("%d %d\n",now.first,now.second);
			c--; if (!c) return 0;
		}
	}
}
/*
*/


#include <sstream>
#include <fstream>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <utility>
#include <cassert>
#include <bitset>
using namespace std;
#define REP(I,N) for (I=0;I<N;I++)
#define rREP(I,N) for (I=N-1;I>=0;I--)
#define rep(I,S,N) for (I=S;I<N;I++)
#define rrep(I,S,N) for (I=N-1;I>=S;I--)
#define FOR(I,S,N) for (I=S;I<=N;I++)
#define rFOR(I,S,N) for (I=N;I>=S;I--)

#define DEBUG
#ifdef DEBUG
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define deputs(str) fprintf(stderr, "%s\n",str)
#else
#define debug(...)
#define deputs(str)
#endif // DEBUG
typedef unsigned long long ULL;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef long long LL;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF=0x3f3f3f3f;
const LL INFF=0x3f3f3f3f3f3f3f3fll;
const LL M=1e9+7;
const LL maxn=4e5+107;
const double pi=acos(-1.0);
const double eps=0.0000000001;
LL gcd(LL a, LL b) {return b?gcd(b,a%b):a;}
template<typename T>inline void pr2(T x,int k=64) {ll i; REP(i,k) debug("%d",(x>>i)&1); putchar(' ');}
template<typename T>inline void add_(T &A,int B,ll MOD=M) {A+=B; (A>=MOD) &&(A-=MOD);}
template<typename T>inline void mul_(T &A,ll B,ll MOD=M) {A=(A*B)%MOD;}
template<typename T>inline void mod_(T &A,ll MOD=M) {A%=MOD; A+=MOD; A%=MOD;}
template<typename T>inline void max_(T &A,T B) {(A<B) &&(A=B);}
template<typename T>inline void min_(T &A,T B) {(A>B) &&(A=B);}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<typename T>inline T powMM(T a, T b) {
	T ret=1;
	for (; b; b>>=1ll,a=(LL)a*a%M)
		if (b&1) ret=(LL)ret*a%M;
	return ret;
}
int startTime;
void startTimer() {startTime=clock();}
void printTimer() {debug("/--- Time: %ld milliseconds ---/\n",clock()-startTime);}

int a[maxn],b[maxn],c[maxn];
//差分后相当
int value[maxn];//count
queue<pair<int,int> > Q;
int main() {
	int n,i,j;
	scanf("%d",&n);
	FOR(i,1,n) scanf("%1d",&a[i]),c[i]=a[i];
	FOR(i,1,n) scanf("%1d",&b[i]);
	FOR(i,1,n-1) {
		if (c[i]!=b[i]) {
			if (c[i]<b[i]) {
				if (Q.size()<=1000000) REP(j,b[i]-c[i])
					if (Q.size()<=1000000) Q.push(make_pair(i,1));
				// printf("%d :+ %d\n",i,b[i]-c[i]);
				c[i+1]+=b[i]-c[i]; c[i]+=b[i]-c[i];
			} else {
				if (Q.size()<=1000000) REP(j,c[i]-b[i])
					if (Q.size()<=1000000) Q.push(make_pair(i,-1));
				// printf("%d :- %d\n",i,c[i]-b[i]);
				c[i+1]-=c[i]-b[i]; c[i]-=c[i]-b[i];
			}
		}
	}
	if (c[n]!=b[n]) return 0*puts("-1");
	else {
		int c=1e5;
		printf("%d\n",(int)Q.size());
		while (Q.size()) {
			auto now=Q.front(); Q.pop();
			if (0<=a[now.first]+now.second&&a[now.first]+now.second<=9&&
				0<=a[now.first+1]+now.second&&a[now.first+1]+now.second<=9){
				a[now.first]+=now.second; a[now.first+1]+=now.second;
		     	printf("%d %d\n",now.first,now.second);
		     	c--; if (!c) return 0;
			} else Q.push(now);
		}
	}
}
/*
*/


#include <sstream>
#include <fstream>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <utility>
#include <cassert>
#include <bitset>
using namespace std;
#define REP(I,N) for (I=0;I<N;I++)
#define rREP(I,N) for (I=N-1;I>=0;I--)
#define rep(I,S,N) for (I=S;I<N;I++)
#define rrep(I,S,N) for (I=N-1;I>=S;I--)
#define FOR(I,S,N) for (I=S;I<=N;I++)
#define rFOR(I,S,N) for (I=N;I>=S;I--)

#define DEBUG
#ifdef DEBUG
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define deputs(str) fprintf(stderr, "%s\n",str)
#else
#define debug(...)
#define deputs(str)
#endif // DEBUG
typedef unsigned long long ULL;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef long long LL;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF=0x3f3f3f3f;
const LL INFF=0x3f3f3f3f3f3f3f3fll;
const LL M=1e9+7;
const LL maxn=4e5+107;
const double pi=acos(-1.0);
const double eps=0.0000000001;
LL gcd(LL a, LL b) {return b?gcd(b,a%b):a;}
template<typename T>inline void pr2(T x,int k=64) {ll i; REP(i,k) debug("%d",(x>>i)&1); putchar(' ');}
template<typename T>inline void add_(T &A,int B,ll MOD=M) {A+=B; (A>=MOD) &&(A-=MOD);}
template<typename T>inline void mul_(T &A,ll B,ll MOD=M) {A=(A*B)%MOD;}
template<typename T>inline void mod_(T &A,ll MOD=M) {A%=MOD; A+=MOD; A%=MOD;}
template<typename T>inline void max_(T &A,T B) {(A<B) &&(A=B);}
template<typename T>inline void min_(T &A,T B) {(A>B) &&(A=B);}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<typename T>inline T powMM(T a, T b) {
	T ret=1;
	for (; b; b>>=1ll,a=(LL)a*a%M)
		if (b&1) ret=(LL)ret*a%M;
	return ret;
}
int startTime;
void startTimer() {startTime=clock();}
void printTimer() {debug("/--- Time: %ld milliseconds ---/\n",clock()-startTime);}

int a[maxn],b[maxn],c[maxn];
//差分后相当
int value[maxn];//count
queue<pair<int,int> > Q;
int main() {
	int n,i,j;
	scanf("%d",&n);
	FOR(i,1,n) scanf("%1d",&a[i]),c[i]=a[i];
	FOR(i,1,n) scanf("%1d",&b[i]);
	FOR(i,1,n-1) {
		if (c[i]!=b[i]) {
			if (c[i]<b[i]) {
				if (Q.size()<=1000000) REP(j,b[i]-c[i])
					if (Q.size()<=1000000) Q.push(make_pair(i,1));
				// printf("%d :+ %d\n",i,b[i]-c[i]);
				c[i+1]+=b[i]-c[i]; c[i]+=b[i]-c[i];
			} else {
				if (Q.size()<=1000000) REP(j,c[i]-b[i])
					if (Q.size()<=1000000) Q.push(make_pair(i,-1));
				// printf("%d :- %d\n",i,c[i]-b[i]);
				c[i+1]-=c[i]-b[i]; c[i]-=c[i]-b[i];
			}
		}
	}
	if (c[n]!=b[n]) return 0*puts("-1");
	else {
		int c=1e5;
		printf("%d\n",(int)Q.size());
		while (Q.size()) {
			auto now=Q.front(); Q.pop();
			if (0<=a[now.first]+now.second&&a[now.first]+now.second<=9&&
				0<=a[now.first+1]+now.second&&a[now.first+1]+now.second<=9){
				a[now.first]+=now.second; a[now.first+1]+=now.second;
			} else Q.push(now);
			printf("%d %d\n",now.first,now.second);
			c--; if (!c) return 0;
		}
	}
}
/*
*/


#include <sstream>
#include <fstream>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <utility>
#include <cassert>
#include <bitset>
using namespace std;
#define REP(I,N) for (I=0;I<N;I++)
#define rREP(I,N) for (I=N-1;I>=0;I--)
#define rep(I,S,N) for (I=S;I<N;I++)
#define rrep(I,S,N) for (I=N-1;I>=S;I--)
#define FOR(I,S,N) for (I=S;I<=N;I++)
#define rFOR(I,S,N) for (I=N;I>=S;I--)

#define DEBUG
#ifdef DEBUG
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define deputs(str) fprintf(stderr, "%s\n",str)
#else
#define debug(...)
#define deputs(str)
#endif // DEBUG
typedef unsigned long long ULL;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef long long LL;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF=0x3f3f3f3f;
const LL INFF=0x3f3f3f3f3f3f3f3fll;
const LL M=1e9+7;
const LL maxn=1e5+107;
const double pi=acos(-1.0);
const double eps=0.0000000001;
LL gcd(LL a, LL b) {return b?gcd(b,a%b):a;}
template<typename T>inline void pr2(T x,int k=64) {ll i; REP(i,k) debug("%d",(x>>i)&1); putchar(' ');}
template<typename T>inline void add_(T &A,int B,ll MOD=M) {A+=B; (A>=MOD) &&(A-=MOD);}
template<typename T>inline void mul_(T &A,ll B,ll MOD=M) {A=(A*B)%MOD;}
template<typename T>inline void mod_(T &A,ll MOD=M) {A%=MOD; A+=MOD; A%=MOD;}
template<typename T>inline void max_(T &A,T B) {(A<B) &&(A=B);}
template<typename T>inline void min_(T &A,T B) {(A>B) &&(A=B);}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<typename T>inline T powMM(T a, T b) {
	T ret=1;
	for (; b; b>>=1ll,a=(LL)a*a%M)
		if (b&1) ret=(LL)ret*a%M;
	return ret;
}
int startTime;
void startTimer() {startTime=clock();}
void printTimer() {debug("/--- Time: %ld milliseconds ---/\n",clock()-startTime);}

int a[maxn],b[maxn];
ll c[maxn],d[maxn],msk[maxn];
//差分后相当
ll all=0;
queue<int> Q;
int main() {
	int n,i;
	scanf("%d",&n);
	FOR(i,1,n) scanf("%1d",&a[i]),c[i]=a[i];
	FOR(i,1,n) scanf("%1d",&b[i]);
	FOR(i,1,n-1) {
		if (c[i]!=b[i]) {
			if (c[i]<b[i]) {
				all+=d[i]=b[i]-c[i]; msk[i]=1; Q.push(i);
				// printf("%d :+ %d\n",i,b[i]-c[i]);
				c[i+1]+=b[i]-c[i]; c[i]+=b[i]-c[i];
			} else {//c[i]>b[i]
				// printf("%d :- %d\n",i,c[i]-b[i]);
				all+=d[i]=c[i]-b[i]; msk[i]=-1; Q.push(i);
				c[i+1]-=c[i]-b[i]; c[i]-=c[i]-b[i];
			}
		}
	}
	// printf("%lld %d\n",c[n],b[n]);
	if (c[n]!=b[n]) return 0*puts("-1");
	else {
		int c=100000;
		printf("%lld\n",all);
		while (Q.size()) {
			auto now=Q.front(); Q.pop();
			if (0+(now==1)<=a[now]+msk[now]&&a[now]+msk[now]<=9&&
				0<=a[now+1]+msk[now]&&a[now+1]+msk[now]<=9){
				a[now]+=msk[now]; a[now+1]+=msk[now]; d[now]--;
				printf("%d %lld\n",now,msk[now]);
				// printf("toward %d %d\n",a[now],a[now+1]);
				c--; if (!c) return 0;
			} if (d[now]) Q.push(now);
		}
	}
}
/*
22
9090909090990909090909
0909090909009090909090
*/


#include <sstream>
#include <fstream>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <utility>
#include <cassert>
#include <bitset>
using namespace std;
#define REP(I,N) for (I=0;I<N;I++)
#define rREP(I,N) for (I=N-1;I>=0;I--)
#define rep(I,S,N) for (I=S;I<N;I++)
#define rrep(I,S,N) for (I=N-1;I>=S;I--)
#define FOR(I,S,N) for (I=S;I<=N;I++)
#define rFOR(I,S,N) for (I=N;I>=S;I--)

#define DEBUG
#ifdef DEBUG
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define deputs(str) fprintf(stderr, "%s\n",str)
#else
#define debug(...)
#define deputs(str)
#endif // DEBUG
typedef unsigned long long ULL;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef long long LL;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF=0x3f3f3f3f;
const LL INFF=0x3f3f3f3f3f3f3f3fll;
const LL M=1e9+7;
const LL maxn=1e5+107;
const double pi=acos(-1.0);
const double eps=0.0000000001;
LL gcd(LL a, LL b) {return b?gcd(b,a%b):a;}
template<typename T>inline void pr2(T x,int k=64) {ll i; REP(i,k) debug("%d",(x>>i)&1); putchar(' ');}
template<typename T>inline void add_(T &A,int B,ll MOD=M) {A+=B; (A>=MOD) &&(A-=MOD);}
template<typename T>inline void mul_(T &A,ll B,ll MOD=M) {A=(A*B)%MOD;}
template<typename T>inline void mod_(T &A,ll MOD=M) {A%=MOD; A+=MOD; A%=MOD;}
template<typename T>inline void max_(T &A,T B) {(A<B) &&(A=B);}
template<typename T>inline void min_(T &A,T B) {(A>B) &&(A=B);}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<typename T>inline T powMM(T a, T b) {
	T ret=1;
	for (; b; b>>=1ll,a=(LL)a*a%M)
		if (b&1) ret=(LL)ret*a%M;
	return ret;
}
int startTime;
void startTimer() {startTime=clock();}
void printTimer() {debug("/--- Time: %ld milliseconds ---/\n",clock()-startTime);}

int a[maxn],b[maxn];
ll c[maxn],d[maxn],msk[maxn];
//差分后相当
ll all=0;
queue<int> Q;
int main() {
	int n,i;
	scanf("%d",&n);
	FOR(i,1,n) scanf("%1d",&a[i]),c[i]=a[i];
	FOR(i,1,n) scanf("%1d",&b[i]);
	FOR(i,1,n-1) {
		if (c[i]!=b[i]) {
			if (c[i]<b[i]) {
				all+=d[i]=b[i]-c[i]; msk[i]=1; Q.push(i);
				// printf("%d :+ %d\n",i,b[i]-c[i]);
				c[i+1]+=b[i]-c[i]; c[i]+=b[i]-c[i];
			} else {//c[i]>b[i]
				// printf("%d :- %d\n",i,c[i]-b[i]);
				all+=d[i]=c[i]-b[i]; msk[i]=-1; Q.push(i);
				c[i+1]-=c[i]-b[i]; c[i]-=c[i]-b[i];
			}
		}
	}
	printf("%lld %d\n",c[n],b[n]);
	if (c[n]!=b[n]) return 0*puts("-1");
	else {
		int c=100000;
		printf("%lld\n",all);
		while (Q.size()) {
			auto now=Q.front(); Q.pop();
			if (0+(now==1)<=a[now]+msk[now]&&a[now]+msk[now]<=9&&
				0<=a[now+1]+msk[now]&&a[now+1]+msk[now]<=9){
				a[now]+=msk[now]; a[now+1]+=msk[now]; d[now]--;
				printf("%d %lld\n",now,msk[now]);
				// printf("toward %d %d\n",a[now],a[now+1]);
				c--; if (!c) return 0;
			} if (d[now]) Q.push(now);
		}
	}
}
/*
22
9090909090990909090909
0909090909009090909090
*/


#include <sstream>
#include <fstream>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <utility>
#include <cassert>
#include <bitset>
using namespace std;
#define REP(I,N) for (I=0;I<N;I++)
#define rREP(I,N) for (I=N-1;I>=0;I--)
#define rep(I,S,N) for (I=S;I<N;I++)
#define rrep(I,S,N) for (I=N-1;I>=S;I--)
#define FOR(I,S,N) for (I=S;I<=N;I++)
#define rFOR(I,S,N) for (I=N;I>=S;I--)

#define DEBUG
#ifdef DEBUG
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define deputs(str) fprintf(stderr, "%s\n",str)
#else
#define debug(...)
#define deputs(str)
#endif // DEBUG
typedef unsigned long long ULL;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef long long LL;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF=0x3f3f3f3f;
const LL INFF=0x3f3f3f3f3f3f3f3fll;
const LL M=1e9+7;
const LL maxn=4e5+107;
const double pi=acos(-1.0);
const double eps=0.0000000001;
LL gcd(LL a, LL b) {return b?gcd(b,a%b):a;}
template<typename T>inline void pr2(T x,int k=64) {ll i; REP(i,k) debug("%d",(x>>i)&1); putchar(' ');}
template<typename T>inline void add_(T &A,int B,ll MOD=M) {A+=B; (A>=MOD) &&(A-=MOD);}
template<typename T>inline void mul_(T &A,ll B,ll MOD=M) {A=(A*B)%MOD;}
template<typename T>inline void mod_(T &A,ll MOD=M) {A%=MOD; A+=MOD; A%=MOD;}
template<typename T>inline void max_(T &A,T B) {(A<B) &&(A=B);}
template<typename T>inline void min_(T &A,T B) {(A>B) &&(A=B);}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<typename T>inline T powMM(T a, T b) {
	T ret=1;
	for (; b; b>>=1ll,a=(LL)a*a%M)
		if (b&1) ret=(LL)ret*a%M;
	return ret;
}
int startTime;
void startTimer() {startTime=clock();}
void printTimer() {debug("/--- Time: %ld milliseconds ---/\n",clock()-startTime);}

int a[maxn],b[maxn],c[maxn];
//差分后相当
int value[maxn];//count
ll all=0;
queue<pair<int,int> > Q;
int main() {
	int n,i,j;
	scanf("%d",&n);
	FOR(i,1,n) scanf("%1d",&a[i]),c[i]=a[i];
	FOR(i,1,n) scanf("%1d",&b[i]);
	FOR(i,1,n-1) {
		if (c[i]!=b[i]) {
			if (c[i]<b[i]) {
				REP(j,min(20,b[i]-c[i])) Q.push(make_pair(i,1));
				all+=b[i]-c[i];
				// printf("%d :+ %d\n",i,b[i]-c[i]);
				c[i+1]+=b[i]-c[i]; c[i]+=b[i]-c[i];
			} else {//c[i]>b[i]
				REP(j,min(20,c[i]-b[i])) Q.push(make_pair(i,-1));
				// printf("%d :- %d\n",i,c[i]-b[i]);
				all+=c[i]-b[i];
				c[i+1]-=c[i]-b[i]; c[i]-=c[i]-b[i];
			}
		}
	}
	if (c[n]!=b[n]) return 0*puts("-1");
	else {
		int c=1e5;
		printf("%lld\n",all);
		while (Q.size()) {
			auto now=Q.front(); Q.pop();
			if (0+(now.first==1)<=a[now.first]+now.second&&a[now.first]+now.second<=9&&
				0+(now.first==1)<=a[now.first+1]+now.second&&a[now.first+1]+now.second<=9){
				a[now.first]+=now.second; a[now.first+1]+=now.second;
			} else Q.push(now);
			printf("%d %d\n",now.first,now.second);
			c--; if (!c) return 0;
		}
	}
}
/*
*/


#include <sstream>
#include <fstream>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <utility>
#include <cassert>
#include <bitset>
using namespace std;
#define REP(I,N) for (I=0;I<N;I++)
#define rREP(I,N) for (I=N-1;I>=0;I--)
#define rep(I,S,N) for (I=S;I<N;I++)
#define rrep(I,S,N) for (I=N-1;I>=S;I--)
#define FOR(I,S,N) for (I=S;I<=N;I++)
#define rFOR(I,S,N) for (I=N;I>=S;I--)

#define DEBUG
#ifdef DEBUG
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define deputs(str) fprintf(stderr, "%s\n",str)
#else
#define debug(...)
#define deputs(str)
#endif // DEBUG
typedef unsigned long long ULL;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef long long LL;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF=0x3f3f3f3f;
const LL INFF=0x3f3f3f3f3f3f3f3fll;
const LL M=1e9+7;
const LL maxn=4e5+107;
const double pi=acos(-1.0);
const double eps=0.0000000001;
LL gcd(LL a, LL b) {return b?gcd(b,a%b):a;}
template<typename T>inline void pr2(T x,int k=64) {ll i; REP(i,k) debug("%d",(x>>i)&1); putchar(' ');}
template<typename T>inline void add_(T &A,int B,ll MOD=M) {A+=B; (A>=MOD) &&(A-=MOD);}
template<typename T>inline void mul_(T &A,ll B,ll MOD=M) {A=(A*B)%MOD;}
template<typename T>inline void mod_(T &A,ll MOD=M) {A%=MOD; A+=MOD; A%=MOD;}
template<typename T>inline void max_(T &A,T B) {(A<B) &&(A=B);}
template<typename T>inline void min_(T &A,T B) {(A>B) &&(A=B);}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<typename T>inline T powMM(T a, T b) {
	T ret=1;
	for (; b; b>>=1ll,a=(LL)a*a%M)
		if (b&1) ret=(LL)ret*a%M;
	return ret;
}
int startTime;
void startTimer() {startTime=clock();}
void printTimer() {debug("/--- Time: %ld milliseconds ---/\n",clock()-startTime);}

int a[maxn],b[maxn],c[maxn],d[maxn],msk[maxn];
//差分后相当
int value[maxn];//count
ll all=0;
queue<int> Q;
int main() {
	int n,i;
	scanf("%d",&n);
	FOR(i,1,n) scanf("%1d",&a[i]),c[i]=a[i];
	FOR(i,1,n) scanf("%1d",&b[i]);
	FOR(i,1,n-1) {
		if (c[i]!=b[i]) {
			if (c[i]<b[i]) {
				all+=d[i]=b[i]-c[i]; msk[i]=1; Q.push(i);
				// printf("%d :+ %d\n",i,b[i]-c[i]);
				c[i+1]+=b[i]-c[i]; c[i]+=b[i]-c[i];
			} else {//c[i]>b[i]
				// printf("%d :- %d\n",i,c[i]-b[i]);
				all+=d[i]=c[i]-b[i]; msk[i]=-1; Q.push(i);
				c[i+1]-=c[i]-b[i]; c[i]-=c[i]-b[i];
			}
		}
	}
	if (c[n]!=b[n]) return 0*puts("-1");
	else {
		int c=1e5;
		printf("%lld\n",all);
		while (Q.size()) {
			auto now=Q.front(); Q.pop();
			if (0+(now==1)<=a[now]+msk[now]&&a[now]+msk[now]<=9&&
				0<=a[now+1]+msk[now]&&a[now+1]+msk[now]<=9){
				a[now]+=msk[now]; a[now+1]+=msk[now]; d[now]--;
			} if (d[now]) Q.push(now);
			printf("%d %d\n",now,msk[now]);
			c--; if (!c) return 0;
		}
	}
}
/*
3
850
102
*/


#include <sstream>
#include <fstream>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <utility>
#include <cassert>
#include <bitset>
using namespace std;
#define REP(I,N) for (I=0;I<N;I++)
#define rREP(I,N) for (I=N-1;I>=0;I--)
#define rep(I,S,N) for (I=S;I<N;I++)
#define rrep(I,S,N) for (I=N-1;I>=S;I--)
#define FOR(I,S,N) for (I=S;I<=N;I++)
#define rFOR(I,S,N) for (I=N;I>=S;I--)

#define DEBUG
#ifdef DEBUG
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define deputs(str) fprintf(stderr, "%s\n",str)
#else
#define debug(...)
#define deputs(str)
#endif // DEBUG
typedef unsigned long long ULL;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef long long LL;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF=0x3f3f3f3f;
const LL INFF=0x3f3f3f3f3f3f3f3fll;
const LL M=1e9+7;
const LL maxn=4e5+107;
const double pi=acos(-1.0);
const double eps=0.0000000001;
LL gcd(LL a, LL b) {return b?gcd(b,a%b):a;}
template<typename T>inline void pr2(T x,int k=64) {ll i; REP(i,k) debug("%d",(x>>i)&1); putchar(' ');}
template<typename T>inline void add_(T &A,int B,ll MOD=M) {A+=B; (A>=MOD) &&(A-=MOD);}
template<typename T>inline void mul_(T &A,ll B,ll MOD=M) {A=(A*B)%MOD;}
template<typename T>inline void mod_(T &A,ll MOD=M) {A%=MOD; A+=MOD; A%=MOD;}
template<typename T>inline void max_(T &A,T B) {(A<B) &&(A=B);}
template<typename T>inline void min_(T &A,T B) {(A>B) &&(A=B);}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<typename T>inline T powMM(T a, T b) {
	T ret=1;
	for (; b; b>>=1ll,a=(LL)a*a%M)
		if (b&1) ret=(LL)ret*a%M;
	return ret;
}
int startTime;
void startTimer() {startTime=clock();}
void printTimer() {debug("/--- Time: %ld milliseconds ---/\n",clock()-startTime);}

int a[maxn],b[maxn],c[maxn];
//差分后相当
int value[maxn];//count
ll all=0;
queue<pair<int,int> > Q;
int main() {
	int n,i,j;
	scanf("%d",&n);
	FOR(i,1,n) scanf("%1d",&a[i]),c[i]=a[i];
	FOR(i,1,n) scanf("%1d",&b[i]);
	FOR(i,1,n-1) {
		if (c[i]!=b[i]) {
			if (c[i]<b[i]) {
				if (Q.size()<=1000000) REP(j,b[i]-c[i])
					if (Q.size()<=1000000) Q.push(make_pair(i,1));
				all+=b[i]-c[i];
				// printf("%d :+ %d\n",i,b[i]-c[i]);
				c[i+1]+=b[i]-c[i]; c[i]+=b[i]-c[i];
			} else {
				if (Q.size()<=1000000) REP(j,c[i]-b[i])
					if (Q.size()<=1000000) Q.push(make_pair(i,-1));
				// printf("%d :- %d\n",i,c[i]-b[i]);
				all+=c[i]-b[i];
				c[i+1]-=c[i]-b[i]; c[i]-=c[i]-b[i];
			}
		}
	}
	if (c[n]!=b[n]) return 0*puts("-1");
	else {
		int c=1e5;
		printf("%lld\n",all);
		while (Q.size()) {
			auto now=Q.front(); Q.pop();
			if (0<=a[now.first]+now.second&&a[now.first]+now.second<=9&&
				0<=a[now.first+1]+now.second&&a[now.first+1]+now.second<=9){
				a[now.first]+=now.second; a[now.first+1]+=now.second;
			} else Q.push(now);
			printf("%d %d\n",now.first,now.second);
			c--; if (!c) return 0;
		}
	}
}
/*
*/


#include <sstream>
#include <fstream>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <utility>
#include <cassert>
#include <bitset>
using namespace std;
#define REP(I,N) for (I=0;I<N;I++)
#define rREP(I,N) for (I=N-1;I>=0;I--)
#define rep(I,S,N) for (I=S;I<N;I++)
#define rrep(I,S,N) for (I=N-1;I>=S;I--)
#define FOR(I,S,N) for (I=S;I<=N;I++)
#define rFOR(I,S,N) for (I=N;I>=S;I--)

#define DEBUG
#ifdef DEBUG
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define deputs(str) fprintf(stderr, "%s\n",str)
#else
#define debug(...)
#define deputs(str)
#endif // DEBUG
typedef unsigned long long ULL;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef long long LL;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF=0x3f3f3f3f;
const LL INFF=0x3f3f3f3f3f3f3f3fll;
const LL M=1e9+7;
const LL maxn=1e5+107;
const double pi=acos(-1.0);
const double eps=0.0000000001;
LL gcd(LL a, LL b) {return b?gcd(b,a%b):a;}
template<typename T>inline void pr2(T x,int k=64) {ll i; REP(i,k) debug("%d",(x>>i)&1); putchar(' ');}
template<typename T>inline void add_(T &A,int B,ll MOD=M) {A+=B; (A>=MOD) &&(A-=MOD);}
template<typename T>inline void mul_(T &A,ll B,ll MOD=M) {A=(A*B)%MOD;}
template<typename T>inline void mod_(T &A,ll MOD=M) {A%=MOD; A+=MOD; A%=MOD;}
template<typename T>inline void max_(T &A,T B) {(A<B) &&(A=B);}
template<typename T>inline void min_(T &A,T B) {(A>B) &&(A=B);}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<typename T>inline T powMM(T a, T b) {
	T ret=1;
	for (; b; b>>=1ll,a=(LL)a*a%M)
		if (b&1) ret=(LL)ret*a%M;
	return ret;
}
int startTime;
void startTimer() {startTime=clock();}
void printTimer() {debug("/--- Time: %ld milliseconds ---/\n",clock()-startTime);}

int a[maxn],b[maxn];
ll c[maxn],d[maxn],msk[maxn];
//差分后相当
ll all=0;
queue<int> Q;
int main() {
	int n,i;
	scanf("%d",&n);
	FOR(i,1,n) scanf("%1d",&a[i]),c[i]=a[i];
	FOR(i,1,n) scanf("%1d",&b[i]);
	FOR(i,1,n-1) {
		if (c[i]!=b[i]) {
			if (c[i]<b[i]) {
				all+=d[i]=b[i]-c[i]; msk[i]=1; Q.push(i);
				// printf("%d :+ %d\n",i,b[i]-c[i]);
				c[i+1]+=b[i]-c[i]; c[i]+=b[i]-c[i];
			} else {//c[i]>b[i]
				// printf("%d :- %d\n",i,c[i]-b[i]);
				all+=d[i]=c[i]-b[i]; msk[i]=-1; Q.push(i);
				c[i+1]-=c[i]-b[i]; c[i]-=c[i]-b[i];
			}
		}
	}
	if (c[n]!=b[n]) return 0*puts("-1");
	else {
		int c=100000;
		printf("%lld\n",all);
		while (Q.size()) {
			auto now=Q.front(); Q.pop();
			if (0+(now==1)<=a[now]+msk[now]&&a[now]+msk[now]<=9&&
				0<=a[now+1]+msk[now]&&a[now+1]+msk[now]<=9){
				a[now]+=msk[now]; a[now+1]+=msk[now]; d[now]--;
				c--; if (!c) return 0;
			} if (d[now]) Q.push(now);
			printf("%d %lld\n",now,msk[now]);
		}
	}
}
/*
3
850
102
*/


#include <sstream>
#include <fstream>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <utility>
#include <cassert>
#include <bitset>
using namespace std;
#define REP(I,N) for (I=0;I<N;I++)
#define rREP(I,N) for (I=N-1;I>=0;I--)
#define rep(I,S,N) for (I=S;I<N;I++)
#define rrep(I,S,N) for (I=N-1;I>=S;I--)
#define FOR(I,S,N) for (I=S;I<=N;I++)
#define rFOR(I,S,N) for (I=N;I>=S;I--)

#define DEBUG
#ifdef DEBUG
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define deputs(str) fprintf(stderr, "%s\n",str)
#else
#define debug(...)
#define deputs(str)
#endif // DEBUG
typedef unsigned long long ULL;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef long long LL;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF=0x3f3f3f3f;
const LL INFF=0x3f3f3f3f3f3f3f3fll;
const LL M=1e9+7;
const LL maxn=4e5+107;
const double pi=acos(-1.0);
const double eps=0.0000000001;
LL gcd(LL a, LL b) {return b?gcd(b,a%b):a;}
template<typename T>inline void pr2(T x,int k=64) {ll i; REP(i,k) debug("%d",(x>>i)&1); putchar(' ');}
template<typename T>inline void add_(T &A,int B,ll MOD=M) {A+=B; (A>=MOD) &&(A-=MOD);}
template<typename T>inline void mul_(T &A,ll B,ll MOD=M) {A=(A*B)%MOD;}
template<typename T>inline void mod_(T &A,ll MOD=M) {A%=MOD; A+=MOD; A%=MOD;}
template<typename T>inline void max_(T &A,T B) {(A<B) &&(A=B);}
template<typename T>inline void min_(T &A,T B) {(A>B) &&(A=B);}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<typename T>inline T powMM(T a, T b) {
	T ret=1;
	for (; b; b>>=1ll,a=(LL)a*a%M)
		if (b&1) ret=(LL)ret*a%M;
	return ret;
}
int startTime;
void startTimer() {startTime=clock();}
void printTimer() {debug("/--- Time: %ld milliseconds ---/\n",clock()-startTime);}

int a[maxn],b[maxn],c[maxn];
//差分后相当
int value[maxn];//count
ll all=0;
queue<pair<int,int> > Q;
int main() {
	int n,i,j;
	scanf("%d",&n);
	FOR(i,1,n) scanf("%1d",&a[i]),c[i]=a[i];
	FOR(i,1,n) scanf("%1d",&b[i]);
	FOR(i,1,n-1) {
		if (c[i]!=b[i]) {
			if (c[i]<b[i]) {
				REP(j,min(20,b[i]-c[i])) Q.push(make_pair(i,1));
				all+=b[i]-c[i];
				// printf("%d :+ %d\n",i,b[i]-c[i]);
				c[i+1]+=b[i]-c[i]; c[i]+=b[i]-c[i];
			} else {//c[i]>b[i]
				REP(j,min(20,c[i]-b[i])) Q.push(make_pair(i,-1));
				// printf("%d :- %d\n",i,c[i]-b[i]);
				all+=c[i]-b[i];
				c[i+1]-=c[i]-b[i]; c[i]-=c[i]-b[i];
			}
		}
	}
	if (c[n]!=b[n]) return 0*puts("-1");
	else {
		int c=1e5;
		printf("%lld\n",all);
		while (Q.size()) {
			auto now=Q.front(); Q.pop();
			if (0+(now.first==1)<=a[now.first]+now.second&&a[now.first]+now.second<=9&&
				0<=a[now.first+1]+now.second&&a[now.first+1]+now.second<=9){
				a[now.first]+=now.second; a[now.first+1]+=now.second;
			printf("%d %d\n",now.first,now.second);
			c--; if (!c) return 0;
			} else Q.push(now);
		}
	}
}
/*
3
850
102
*/