#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<fstream>
using namespace std;
struct Node
{
	int i, j, k;
};
int A[1024][1024];
int D[1024][1024];
Node e;
queue<Node> q;
int v[1024*1024], N, M;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,-1,0,1 };

bool isInside(int i, int j)
{
	return i >= 1 && i <= N && j >= 1 && j <= M;
}
void Lee(int i, int j, int f)
{
	e.i = i;
	e.j = j;
	e.k = f;
	D[i][j] = f;
	q.push(e);

	while (q.size())
	{
		Node z;
		e = q.front();
		for (int k = 0;k < 4;++k)
			if (isInside(e.i + dx[k], e.j + dy[k]) && A[e.i + dx[k]][e.j + dy[k]] != -1 && D[e.i + dx[k]][e.j + dy[k]] == 0)
			{
				++v[f];
				A[e.i + dx[k]][e.j + dy[k]] = A[e.i][e.j] + 1;
				D[e.i + dx[k]][e.j + dy[k]] = f;
				z.i = e.i + dx[k];
				z.j = e.j + dy[k];
				z.k = f;
				q.push(z);
			}
		q.pop();
	}
}

int main()
{
	cin >> N >> M;
	char c;
	for (int i = 1;i <= N;++i)
		for (int j = 1;j <= M;++j)
		{
			cin >> c;
			if (c == '*')
				A[i][j] = -1;
		}
	int k = 1;
	for (int i = 1;i <= N;++i)
		for (int j = 1;j <= M;++j)
			if (A[i][j] == 0 && D[i][j] == 0)
			{
				Lee(i, j, k);
				++k;
			}
	int s = 0, pa, ok = 1;
	vector<int> la;
	for (int i = 1;i <= N;++i)
	{
		for (int j = 1;j <= M;++j)
		{
			if (A[i][j] == -1)
			{
				s = 1;
				for (int k = 0;k < 4;++k)
				{
					if (isInside(i + dx[k], j + dy[k]) && A[i + dx[k]][j + dy[k]] != -1)
					{
						ok = 0;
						for (pa = 0;pa < la.size();++pa)
							if (la[pa] == D[i + dx[k]][j + dy[k]])
								ok = 1;
						if (!ok)
						{
							s = s + v[D[i + dx[k]][j + dy[k]]]+1;
							la.push_back(D[i + dx[k]][j + dy[k]]);
						}

					}
				}
				cout << s % 10;
				la.clear();
			}
			else
				cout << ".";
		}
		cout << '\n';
	}
	return 0;

}


#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<fstream>
using namespace std;
struct Node
{
	int i, j, k;
};
int A[1024][1024];
int D[1024][1024];
Node e;
queue<Node> q;
int v[1024],N,M;
int dx[4] = {1,0,-1,0};
int dy[4] = { 0,-1,0,1 };

bool isInside(int i, int j)
{
	return i >= 1 && i <= N && j >= 1 && j <= M;
}
void Lee(int i,int j,int f)
{
	e.i = i;
	e.j = j;
	e.k = f;
	D[i][j] = f;
	q.push(e);

	while (q.size())
	{
		Node z;
		e = q.front();
		for (int k = 0;k < 4;++k)
			if (isInside(e.i + dx[k], e.j + dy[k]) && A[e.i + dx[k]][e.j + dy[k]]!=-1 && D[e.i + dx[k]][e.j + dy[k]]== 0)
			{
				++v[f];
				A[e.i + dx[k]][e.j + dy[k]] = A[e.i][e.j] + 1;
				D[e.i + dx[k]][e.j + dy[k]] = f;
				z.i = e.i + dx[k];
				z.j = e.j + dy[k];
				z.k = f;
				q.push(z);
			}
		q.pop();
	}
}

int main()
{
	cin >> N >> M;
	char c;
	for (int i = 1;i <= N;++i)
		for (int j = 1;j <= M;++j)
		{
			cin >> c;
			if (c == '*')
				A[i][j] = -1;
		}
	int k = 1;
	for (int i = 1;i <= N;++i)
		for (int j = 1;j <= M;++j)
			if (A[i][j] == 0 && D[i][j] == 0)
			{
				Lee(i, j, k);
				++k;
			}
	int s = 0,pa,ok=1;
	vector<int> la;
	for (int i = 1;i <= N;++i)
	{
		for (int j = 1;j <= M;++j)
		{
			if (A[i][j] == -1)
			{
				s = 1;
				for (int k = 0;k < 4;++k)
				{
					if (isInside(i + dx[k], j + dy[k]) && A[i + dx[k]][j + dy[k]] != -1)
					{
						ok = 0;
						for (pa = 0;pa < la.size();++pa)
							if (la[pa] == D[i + dx[k]][j + dy[k]])
								ok = 1;
						if (!ok)
						{
							s = s + v[D[i + dx[k]][j + dy[k]]] + 1;
							la.push_back(D[i + dx[k]][j + dy[k]]);
						}

					}
				}
				la.clear();
			}
			else
				cout << ".";
		}
		cout << '\n';
	}
	return 0;

}


#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<fstream>
using namespace std;
struct Node
{
	int i, j, k;
};
int A[1024][1024];
int D[1024][1024];
Node e;
queue<Node> q;
int v[1024],N,M;
int dx[4] = {1,0,-1,0};
int dy[4] = { 0,-1,0,1 };

bool isInside(int i, int j)
{
	return i >= 1 && i <= N && j >= 1 && j <= M;
}
void Lee(int i,int j,int f)
{
	e.i = i;
	e.j = j;
	e.k = f;
	D[i][j] = f;
	q.push(e);

	while (q.size())
	{
		Node z;
		e = q.front();
		for (int k = 0;k < 4;++k)
			if (isInside(e.i + dx[k], e.j + dy[k]) && A[e.i + dx[k]][e.j + dy[k]]!=-1 && D[e.i + dx[k]][e.j + dy[k]]== 0)
			{
				++v[f];
				A[e.i + dx[k]][e.j + dy[k]] = A[e.i][e.j] + 1;
				D[e.i + dx[k]][e.j + dy[k]] = f;
				z.i = e.i + dx[k];
				z.j = e.j + dy[k];
				z.k = f;
				q.push(z);
			}
		q.pop();
	}
}

int main()
{
	cin >> N >> M;
	char c;
	for (int i = 1;i <= N;++i)
		for (int j = 1;j <= M;++j)
		{
			cin >> c;
			if (c == '*')
				A[i][j] = -1;
		}
	int k = 1;
	for (int i = 1;i <= N;++i)
		for (int j = 1;j <= M;++j)
			if (A[i][j] == 0 && D[i][j] == 0)
			{
				Lee(i, j, k);
				++k;
			}
	int s = 0,pa,ok=1;
	vector<int> la;
	for (int i = 1;i <= N;++i)
	{
		for (int j = 1;j <= M;++j)
		{
			if (A[i][j] == -1)
			{
				s = 1;
				ok = 1;
				for (int k = 0;k < 4;++k)
				{
					if (isInside(i + dx[k], j + dy[k]) && A[i + dx[k]][j + dy[k]] != -1)
					{
						ok = 0;
						for (pa = 0;pa < la.size();++pa)
							if (la[pa] == D[i + dx[k]][j + dy[k]])
								ok = 1;
						if (!ok)
						{
							s = s + v[D[i + dx[k]][j + dy[k]]] + 1;
							la.push_back(D[i + dx[k]][j + dy[k]]);
						}

					}
				}
				cout << s;
				la.clear();
			}
			else
				cout << ".";
		}
		cout << '\n';
	}
	return 0;

}


#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<fstream>
using namespace std;
struct Node
{
	int i, j, k;
};
int A[1024][1024];
int D[1024][1024];
Node e;
queue<Node> q;
int v[1024], N, M;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,-1,0,1 };

bool isInside(int i, int j)
{
	return i >= 1 && i <= N && j >= 1 && j <= M;
}
void Lee(int i, int j, int f)
{
	e.i = i;
	e.j = j;
	e.k = f;
	D[i][j] = f;
	v[f] = 1;
	q.push(e);

	while (q.size())
	{
		Node z;
		e = q.front();
		for (int k = 0;k < 4;++k)
			if (isInside(e.i + dx[k], e.j + dy[k]) && A[e.i + dx[k]][e.j + dy[k]] != -1 && D[e.i + dx[k]][e.j + dy[k]] == 0)
			{
				++v[f];
				A[e.i + dx[k]][e.j + dy[k]] = A[e.i][e.j] + 1;
				D[e.i + dx[k]][e.j + dy[k]] = f;
				z.i = e.i + dx[k];
				z.j = e.j + dy[k];
				z.k = f;
				q.push(z);
			}
		q.pop();
	}
}

int main()
{
	cin >> N >> M;
	char c;
	for (int i = 1;i <= N;++i)
		for (int j = 1;j <= M;++j)
		{
			cin >> c;
			if (c == '*')
				A[i][j] = -1;
		}
	int k = 1;
	for (int i = 1;i <= N;++i)
		for (int j = 1;j <= M;++j)
			if (A[i][j] == 0 && D[i][j] == 0)
			{
				Lee(i, j, k);
				++k;
			}
	int s = 0, pa, ok = 1;
	vector<int> la;
	for (int i = 1;i <= N;++i)
	{
		for (int j = 1;j <= M;++j)
		{
			if (A[i][j] == -1)
			{
				s = 1;
				for (int k = 0;k < 4;++k)
				{
					if (isInside(i + dx[k], j + dy[k]) && A[i + dx[k]][j + dy[k]] != -1)
					{
						ok = 0;
						for (pa = 0;pa < la.size();++pa)
							if (la[pa] == D[i + dx[k]][j + dy[k]])
								ok = 1;
						if (!ok)
						{
							s = s + v[D[i + dx[k]][j + dy[k]]];
							la.push_back(D[i + dx[k]][j + dy[k]]);
						}

					}
				}
				cout << s % 10;
				la.clear();
			}
			else
				cout << ".";
		}
		cout << '\n';
	}
	return 0;

}


#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<fstream>
using namespace std;
struct Node
{
	int i, j, k;
};
int A[1024][1024];
int D[1024][1024];
Node e;
queue<Node> q;
int v[1024*1024], N, M;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,-1,0,1 };

bool isInside(int i, int j)
{
	return i >= 1 && i <= N && j >= 1 && j <= M;
}
void Lee(int i, int j, int f)
{
	e.i = i;
	e.j = j;
	e.k = f;
	D[i][j] = f;
	v[f] = 1;
	q.push(e);

	while (q.size())
	{
		Node z;
		e = q.front();
		for (int k = 0;k < 4;++k)
			if (isInside(e.i + dx[k], e.j + dy[k]) && A[e.i + dx[k]][e.j + dy[k]] != -1 && D[e.i + dx[k]][e.j + dy[k]] == 0)
			{
				++v[f];
				A[e.i + dx[k]][e.j + dy[k]] = A[e.i][e.j] + 1;
				D[e.i + dx[k]][e.j + dy[k]] = f;
				z.i = e.i + dx[k];
				z.j = e.j + dy[k];
				z.k = f;
				q.push(z);
			}
		q.pop();
	}
}

int main()
{
	cin >> N >> M;
	char c;
	for (int i = 1;i <= N;++i)
		for (int j = 1;j <= M;++j)
		{
			cin >> c;
			if (c == '*')
				A[i][j] = -1;
		}
	int k = 1;
	for (int i = 1;i <= N;++i)
		for (int j = 1;j <= M;++j)
			if (A[i][j] == 0 && D[i][j] == 0)
			{
				Lee(i, j, k);
				++k;
			}
	int s = 0, pa, ok = 1;
	vector<int> la;
	for (int i = 1;i <= N;++i)
	{
		for (int j = 1;j <= M;++j)
		{
			if (A[i][j] == -1)
			{
				s = 1;
				for (int k = 0;k < 4;++k)
				{
					if (isInside(i + dx[k], j + dy[k]) && A[i + dx[k]][j + dy[k]] != -1)
					{
						ok = 0;
						for (pa = 0;pa < la.size();++pa)
							if (la[pa] == D[i + dx[k]][j + dy[k]])
								ok = 1;
						if (!ok)
						{
							s = s + v[D[i + dx[k]][j + dy[k]]];
							la.push_back(D[i + dx[k]][j + dy[k]]);
						}

					}
				}
				cout << s % 10;
				la.clear();
			}
			else
				cout << ".";
		}
		cout << '\n';
	}
	return 0;

}


#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<fstream>
using namespace std;
struct Node
{
	int i, j, k;
};
int A[1024][1024];
int D[1024][1024];
Node e;
queue<Node> q;
int v[1024],N,M;
int dx[4] = {1,0,-1,0};
int dy[4] = { 0,-1,0,1 };

bool isInside(int i, int j)
{
	return i >= 1 && i <= N && j >= 1 && j <= M;
}
void Lee(int i,int j,int f)
{
	e.i = i;
	e.j = j;
	e.k = f;
	D[i][j] = f;
	q.push(e);

	while (q.size())
	{
		Node z;
		e = q.front();
		for (int k = 0;k < 4;++k)
			if (isInside(e.i + dx[k], e.j + dy[k]) && A[e.i + dx[k]][e.j + dy[k]]!=-1 && D[e.i + dx[k]][e.j + dy[k]]== 0)
			{
				++v[f];
				A[e.i + dx[k]][e.j + dy[k]] = A[e.i][e.j] + 1;
				D[e.i + dx[k]][e.j + dy[k]] = f;
				z.i = e.i + dx[k];
				z.j = e.j + dy[k];
				z.k = f;
				q.push(z);
			}
		q.pop();
	}
}

int main()
{
	cin >> N >> M;
	char c;
	for (int i = 1;i <= N;++i)
		for (int j = 1;j <= M;++j)
		{
			cin >> c;
			if (c == '*')
				A[i][j] = -1;
		}
	int k = 1;
	for (int i = 1;i <= N;++i)
		for (int j = 1;j <= M;++j)
			if (A[i][j] == 0 && D[i][j] == 0)
			{
				Lee(i, j, k);
				++k;
			}
	int s = 0,pa,ok=1;
	vector<int> la;
	for (int i = 1;i <= N;++i)
	{
		for (int j = 1;j <= M;++j)
		{
			if (A[i][j] == -1)
			{
				s = 1;
				for (int k = 0;k < 4;++k)
				{
					if (isInside(i + dx[k], j + dy[k]) && A[i + dx[k]][j + dy[k]] != -1)
					{
						ok = 0;
						for (pa = 0;pa < la.size();++pa)
							if (la[pa] == D[i + dx[k]][j + dy[k]])
								ok = 1;
						if (!ok)
						{
							s = s + v[D[i + dx[k]][j + dy[k]]] + 1;
							la.push_back(D[i + dx[k]][j + dy[k]]);
						}

					}
				}
				cout << s;
				la.clear();
			}
			else
				cout << ".";
		}
		cout << '\n';
	}
	return 0;

}


#include<bits/stdc++.h>
#include <algorithm>
#include<vector>
#include<list>
#include<utility>
#include<map>
#include<set>
#include<stack>
#include<queue>
#define ll long long int
#define fill(a,v) memset(a,v,sizeof a)
#define FORN(i, n) for(i = 0; i < n; i++)
#define mp make_pair
#define pb push_back
#define s(a) sort(a.begin(),a.end())
#define sa(a,n) sort(a,a+(n))
#define ff first
#define ss second
#define elif else if
using namespace std;
ll i,j,n;
string s[1001];
ll mx[]={1,-1,0,0};
ll my[]={0,0,-1,1};
ll vis[1001][1001];
ll m;
ll dfs(ll x,ll y)
{
	vis[x][y]=1;
	ll temp=1;
	for(ll k=0;k<4;k++)
	{
		ll X=x+mx[k];
		ll Y=y+my[k];
		if(X>=0 && X<n && Y>=0 && Y<m)
		{
			if(s[X][Y]=='.' && !vis[X][Y])
			{
				temp+=dfs(X,Y);
			}
		}
	}
	return temp;
}
int main()
{
	cin>>n>>m;
	for(i=0;i<n;i++)
	{
		cin>>s[i];
	}
	ll p[n][m];
	fill(p,0);
	ll vis1[n][m];
	fill(vis1,0);
	for(i=0;i<n;i++)
	{
		for (j = 0; j < s[i].size(); j++)
		{
			if(s[i][j]=='*')
			{
				fill(vis,0);
				p[i][j]=dfs(i,j);
				p[i][j]=(p[i][j])%10;
				vis1[i][j]=1;
			}
		}
	}
	for(i=0;i<n;i++)
	{
		for (j = 0; j < m; j++)
		{
			if(vis1[i][j]!=0)
			cout<<p[i][j];
		else
			cout<<s[i][j];
		}
		cout<<endl;
	}

  return 0;
  }


#include<bits/stdc++.h>
#include <algorithm>
#include<vector>
#include<list>
#include<utility>
#include<map>
#include<set>
#include<stack>
#include<queue>
#define ll long long int
#define fill(a,v) memset(a,v,sizeof a)
#define FORN(i, n) for(i = 0; i < n; i++)
#define mp make_pair
#define pb push_back
#define s(a) sort(a.begin(),a.end())
#define sa(a,n) sort(a,a+(n))
#define ff first
#define ss second
#define elif else if
using namespace std;
ll i,j,n;
char a[1001][1001];
ll mx[]={1,-1,0,0};
ll my[]={0,0,-1,1};
ll vis[1001][1001];
ll m;
ll dfs(ll x,ll y)
{
	vis[x][y]=1;
	ll temp=1;
	for(ll k=0;k<4;k++)
	{
		ll X=x+mx[k];
		ll Y=y+my[k];
		if(X>=0 && X<n && Y>=0 && Y<m)
		{
			if(a[X][Y]=='.' && !vis[X][Y])
			{
				temp+=dfs(X,Y);
			}
		}
	}
	return temp;
}
int main()
{
	cin>>n>>m;
	for(i=0;i<n;i++)
	{
		for (j = 0; j < m; j++)
		{
			cin>>a[i][j];
		}
	}
	for(i=0;i<n;i++)
	{
		for (j = 0; j < m; j++)
		{
			if(a[i][j]=='*')
			{
				fill(vis,0);
				a[i][j]=dfs(i,j)+48;
			}
		}
	}
	for(i=0;i<n;i++)
	{
		for (j = 0; j < m; j++)
		{
			cout<<a[i][j];
		}
		cout<<endl;
	}

  return 0;
  }


#include<bits/stdc++.h>
#define ll long long int
#define fill(a,v) memset(a,v,sizeof a)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
using namespace std;
ll i,j,n;
char a[1201][1201];
ll vis[1201][1201];
ll cat[1201][1201];
ll cnt[1200005];
ll dx[]={-1,0,1,0};
ll dy[]={0,1,0,-1};
ll m;
ll dfs(ll x,ll y,ll no)
{
    vis[x][y]=1;
    cat[x][y]=no;
    ll temp=1;
    for(ll k=0;k<4;k++)
    {
        ll newx=x+dx[k];
        ll newy=y+dy[k];
        if(!vis[newx][newy] && a[newx][newy]=='.')
        {
            temp+=dfs(newx,newy,no);
        }
    }
    return temp;
}
int main()
{

    ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cin>>n>>m;
        for(i=1;i<=n;i++)
        {
            for(j=1;j<=m;j++)
                cin>>a[i][j];
        }
        ll no=0;
        for(i=1;i<=n;i++)
        {
            for(j=1;j<=m;j++)
            {
                if(a[i][j]=='.' && !vis[i][j])
                {
                    no++;
                    cnt[no]=dfs(i,j,no);
                }
            }
        }
        set<ll>s;
        set<ll>::iterator it;
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=m;j++)
        {
            s.clear();
            if(a[i][j]=='.')
                cout<<".";
            if(a[i][j]=='*')
            {

                s.insert(cat[i+1][j]);
                s.insert(cat[i-1][j]);
                s.insert(cat[i][j+1]);
                s.insert(cat[i][j-1]);
                ll ans=1;
                for(it=s.begin();it!=s.end();it++)
                    ans+=cnt[*it];
                ll p=ans%10;
                cout<<p;
            }
        }
        cout<<endl;
    }
    return 0;

  return 0;
  }


#include<bits/stdc++.h>
#include <algorithm>
#include<vector>
#include<list>
#include<utility>
#include<map>
#include<set>
#include<stack>
#include<queue>
#define ll long long int
#define fill(a,v) memset(a,v,sizeof a)
#define FORN(i, n) for(i = 0; i < n; i++)
#define mp make_pair
#define pb push_back
#define s(a) sort(a.begin(),a.end())
#define sa(a,n) sort(a,a+(n))
#define ff first
#define ss second
#define elif else if
using namespace std;
ll i,j,n;
char a[1001][1001];
ll mx[]={1,-1,0,0};
ll my[]={0,0,-1,1};
ll vis[1001][1001];
ll m;
ll dfs(ll x,ll y)
{
	vis[x][y]=1;
	ll temp=1;
	for(ll k=0;k<4;k++)
	{
		ll X=x+mx[k];
		ll Y=y+my[k];
		if(X>=0 && X<n && Y>=0 && Y<m)
		{
			if(a[X][Y]=='.' && !vis[X][Y])
			{
				temp+=dfs(X,Y);
			}
		}
	}
	return temp;
}
int main()
{
	cin>>n>>m;
	for(i=0;i<n;i++)
	{
		for (j = 0; j < m; j++)
		{
			cin>>a[i][j];
		}
	}
	ll p[n][m];
	fill(p,0);
	for(i=0;i<n;i++)
	{
		for (j = 0; j < m; j++)
		{
			if(a[i][j]=='*')
			{
				fill(vis,0);
				p[i][j]=dfs(i,j);
			}
		}
	}
	for(i=0;i<n;i++)
	{
		for (j = 0; j < m; j++)
		{
			if(p[i][j]!=0)
			cout<<p[i][j];
		else
			cout<<a[i][j];
		}
		cout<<endl;
	}

  return 0;
  }


#include<bits/stdc++.h>
#include <algorithm>
#include<vector>
#include<list>
#include<utility>
#include<map>
#include<set>
#include<stack>
#include<queue>
#define ll long long int
#define fill(a,v) memset(a,v,sizeof a)
#define FORN(i, n) for(i = 0; i < n; i++)
#define mp make_pair
#define pb push_back
#define s(a) sort(a.begin(),a.end())
#define sa(a,n) sort(a,a+(n))
#define ff first
#define ss second
#define elif else if
using namespace std;
ll i,j,n;
char a[1001][1001];
ll vis[1001][1001];
ll cat[1001][1001];
ll cnt[1000005];
ll dx[]={-1,0,1,0};
ll dy[]={0,1,0,-1};
ll m;
ll dfs(ll x,ll y,ll no)
{
    vis[x][y]=1;
    cat[x][y]=no;
    ll temp=1;
    for(ll k=0;k<4;k++)
    {
        ll newx=x+dx[k];
        ll newy=y+dy[k];
        if(newx>n || newx<1 || newy>m || newy<1)
            continue;
        if(!vis[newx][newy] && a[newx][newy]=='.')
        {
            temp+=dfs(newx,newy,no);
        }
    }
    return temp;
}
int main()
{

    ios_base::sync_with_stdio(false);
        cin.tie(NULL);

        cin>>n>>m;
        for(i=1;i<=n;i++)
        {
            for(j=1;j<=m;j++)
                cin>>a[i][j];
        }
        ll no=0;
        for(i=1;i<=n;i++)
        {
            for(j=1;j<=m;j++)
            {
                if(a[i][j]=='.' && !vis[i][j])
                {
                    no++;
                    cnt[no]=dfs(i,j,no);
                }
            }
        }
        set<ll>s;
        set<ll>::iterator it;
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=m;j++)
        {
            s.clear();
            if(a[i][j]=='*')
            {
                s.insert(cat[i+1][j]);
                s.insert(cat[i-1][j]);
                s.insert(cat[i][j+1]);
                s.insert(cat[i][j-1]);
                ll ans=0;
                for(it=s.begin();it!=s.end();it++)
                    ans+=cnt[*it];
                printf("%lld",(ans+1)%10);
            }
            else if(a[i][j]=='.')
                cout<<'.';
        }
        printf("\n");
    }

  return 0;
  }


//besmellah
#include <bits/stdc++.h>
using namespace std;

const int maxn = 2e6 + 65;
int V[maxn], U[maxn], n;
vector <int> adj[maxn], ans, E;
bitset <maxn> vmark, mark;

void dfs(int v, int ee) {
	vmark[v] = 1;
	for (auto e: adj[v]) {
		int u = V[e] ^ U[e] ^ v;
		if (!mark[e]) {
			mark[e] = 1;
			dfs(u, e);
		}
	}
	E.push_back(ee);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int m;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> V[i] >> U[i];
		V[i]--;
		U[i]--;
		adj[V[i]].push_back(i);
		adj[U[i]].push_back(i);
	}
	int M = m;
	for (int i = 0; i < n; i++) {
		if (adj[i].size() % 2) {
			V[M] = i, U[M] = n;
			adj[i].push_back(M);
			adj[n].push_back(M);
			M++;
		}
	}
	for (int i = 0; i <= n; i++) {
		if (!vmark[i]) {
			E.push_back(m + 1);
			dfs(i, -1);
			E.pop_back();
		}
	}
	int T = 0;
	for (int i = 0; i < E.size(); i++) {
//		cout << E[i] << ' ' << V[E[i]] + 1 << ' ' << U[E[i]] + 1 << endl;
		if ((!T || (i + 1 < E.size() && E[i + 1] >= m)) && E[i] < m) {
			ans.push_back(E[i]);
		}
		T ^= 1;
		if (E[i] >= m) T = 0;
	}
	cout << ans.size() << '\n';
	for (auto e: ans) {
		cout << V[e] + 1 << ' ' << U[e] + 1 << '\n';
	}
}


//besmellah
#include <bits/stdc++.h>
using namespace std;

const int maxn = 2e6 + 65;
int V[maxn], U[maxn], n;
vector <int> adj[maxn / 2], ans, E;
bitset <maxn> vmark, mark;

void dfs(int v, int ee) {
	vmark[v] = 1;
	for (auto e: adj[v]) {
		int u = V[e] ^ U[e] ^ v;
		if (!mark[e]) {
			mark[e] = 1;
			dfs(u, e);
		}
	}
	E.push_back(ee);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
//	cout.tie(0);
	int m;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> V[i] >> U[i];
		V[i]--;
		U[i]--;
		adj[V[i]].push_back(i);
		adj[U[i]].push_back(i);
	}
	int M = m;
	for (int i = 0; i < n; i++) {
		if (adj[i].size() % 2) {
			V[M] = i, U[M] = n;
			adj[i].push_back(M);
			adj[n].push_back(M);
			M++;
		}
	}
	if (n == 1e6) assert(0);
	E.push_back(m + 1);
	for (int i = 0; i < n; i++) {
		if (!vmark[i]) {
			dfs(i, m + 1);
		}
	}
	if (n == 1e6) assert(0);
	E.pop_back();
	int T = 0;
	for (int i = 0; i < E.size(); i++) {
//		cout << E[i] << ' ' << V[E[i]] + 1 << ' ' << U[E[i]] + 1 << endl;
		if ((!T || (i + 1 < E.size() && E[i + 1] >= m)) && E[i] < m) {
			ans.push_back(E[i]);
		}
		T ^= 1;
		if (E[i] >= m) T = 0;
	}
	cout << ans.size() << '\n';
	for (auto e: ans) {
		cout << V[e] + 1 << ' ' << U[e] + 1 << '\n';
	}
}


//besmellah
#include <bits/stdc++.h>
using namespace std;

const int maxn = 2e6 + 65;
int V[maxn], U[maxn], n;
vector <int> adj[maxn / 2], ans, E;
bitset <maxn> vmark, mark;

void dfs(int v, int ee) {
	vmark[v] = 1;
	while (adj[v].size()) {
		int e = adj[v].back();
		adj[v].pop_back();
		int u = V[e] ^ U[e] ^ v;
		if (!mark[e]) {
			mark[e] = 1;
			dfs(u, e);
		}
	}
	E.push_back(ee);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
//	cout.tie(0);
	int m;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> V[i] >> U[i];
		V[i]--;
		U[i]--;
		adj[V[i]].push_back(i);
		adj[U[i]].push_back(i);
	}
	int M = m;
	for (int i = 0; i < n; i++) {
		if (adj[i].size() % 2) {
			V[M] = i, U[M] = n;
			adj[i].push_back(M);
			adj[n].push_back(M);
			M++;
		}
	}
//	if (n == 1e6) assert(0);
	E.push_back(m + 1);
	for (int i = 0; i < n; i++) {
		if (!vmark[i]) {
			dfs(i, m + 1);
		}
	}
//	if (n == 1e6) assert(0);
	E.pop_back();
	int T = 0;
	for (int i = 0; i < E.size(); i++) {
//		cout << E[i] << ' ' << V[E[i]] + 1 << ' ' << U[E[i]] + 1 << endl;
		if ((!T || (i + 1 < E.size() && E[i + 1] >= m)) && E[i] < m) {
			ans.push_back(E[i]);
		}
		T ^= 1;
		if (E[i] >= m) T = 0;
	}
	cout << ans.size() << '\n';
	for (auto e: ans) {
		cout << V[e] + 1 << ' ' << U[e] + 1 << '\n';
	}
}


#include<bits/stdc++.h>
using namespace std;
const int M=1000000007;
int n,m,d[1000005],i,j,k,ansu[1000005],ansv[1000005],p;
int head[1000005],Next[2000005],adj[2000005],u,v;
void Push(int u,int v)
{
	Next[++k]=head[u];
	head[u]=k;
	adj[k]=v;
}
struct str{
	int s,x;
}a[1000005];
bool operator <(str a,str b)
{
	return a.s>b.s;
}
priority_queue<str> q;
bool cmp(str a,str b)
{
	return a.s>b.s;
}
int main()
{
	scanf("%d %d",&n,&m);
	for(i=1;i<=n;i++)
	{
		scanf("%d %d",&u,&v);
		Push(u,v);
		Push(v,u);
		d[u]++;
		d[v]++;
	}
	for(i=1;i<=n;i++)
	{
		d[i]/=2;
		q.push((str){d[i],i});
	}
	while(!q.empty())
	{
		str x=q.top();
		q.pop();
		if(d[x.x]==-1)
			continue;
		k=0;
		for(j=head[x.x];j!=0;j=Next[j])
			if(d[adj[j]]>0)
				a[++k]=(str){d[adj[j]],adj[j]};
		sort(a+1,a+1+k,cmp);
		for(i=1;i<=k&&i<=d[x.x];i++)
		{
			d[a[i].x]--;
			q.push((str){d[a[i].x],a[i].x});
		}
		for(i=d[x.x]+1;i<=k;i++)
		{
			ansu[++p]=x.x;
			ansv[p]=a[i].x;
		}
		d[x.x]=-1;
	}
	printf("%d\n",p);
	for(i=1;i<=p;i++)
		printf("%d %d\n",ansu[i],ansv[i]);
}


#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;

const int Maxn=1e6;

int N,M,totm;
int d[Maxn+5];

struct Node {
	int to;
	int id;
};
vector<Node> G[Maxn+5];
struct Edge {
	int u,v;
	int typ;
};
vector<Edge> e;
void addedge(int u,int v,int typ) {
	e.push_back(Edge{u,v,typ});
	G[u].push_back(Node{v,totm});
	G[v].push_back(Node{u,totm});
	if(typ)d[u]++,d[v]++;
}

bool vis[Maxn*2+5],del[Maxn*2+5];
int tmp[Maxn*2+5],cnt;
int S[Maxn+5];
int stk[Maxn*2+5],ed[Maxn*2+5],top;
void EulerPath(int s) {
	cnt=0,stk[++top]=s;
	while(top>0) {
		int u=stk[top],v=-1,i;
		for(i=S[u];i<G[u].size();i++)
			if(!vis[G[u][i].id]) {
				v=G[u][i].to;
				break;
			}
		if(i<G[u].size()) {
			stk[++top]=v;
			ed[top]=G[u][i].id;
			vis[G[u][i].id]=true;
			S[u]=i+1;
		} else {
			tmp[++cnt]=ed[top--];
		}
	}
}

int main() {
	#ifdef LOACL
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	scanf("%d %d",&N,&M);
	for(int i=1;i<=M;i++) {
		int u,v;
		scanf("%d %d",&u,&v);
		addedge(u,v,1);
		totm++;
	}
	for(int i=1;i<=N;i++)
		if(d[i]%2)
			addedge(0,i,0),totm++;
	int num=M;
	for(int i=0;i<=N;i++) {
		EulerPath(i);
		for(int j=2;j<=cnt;j+=2) {
			int id=tmp[j];
			if(e[id].typ==0)
				del[id]=true;
			else {
				int t=tmp[j-1];
				if(e[t].typ==0&&del[t]==false) {
					del[t]=true;
					continue;
				}
				t=tmp[j%cnt+1];
				if(e[t].typ==0&&del[t]==false) {
					del[t]=true;
					continue;
				}
				del[id]=true;
				num--;
			}
		}
	}
	printf("%d\n",num);
	for(int i=0;i<e.size();i++)
		if(del[i]==false&&e[i].typ==1)
			printf("%d %d\n",e[i].u,e[i].v);
	return 0;
}


#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;

const int Maxn=1e6;

int N,M,totm;
int d[Maxn+5];

struct Node {
	int to;
	int id;
};
vector<Node> G[Maxn+5];
struct Edge {
	int u,v;
	int typ;
};
vector<Edge> e;
void addedge(int u,int v,int typ) {
	e.push_back(Edge{u,v,typ});
	G[u].push_back(Node{v,totm});
	G[v].push_back(Node{u,totm});
	if(typ)d[u]++,d[v]++;
}

bool vis[Maxn*2+5],del[Maxn*2+5];
vector<int> tmp;

void EulerPath(int u) {
	for(int i=0;i<G[u].size();i++) {
		int v=G[u][i].to,id=G[u][i].id;
		if(vis[id])continue;
		tmp.push_back(id);
		vis[id]=true;
		EulerPath(v);
	}
}

int main() {
	#ifdef LOACL
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	scanf("%d %d",&N,&M);
	for(int i=1;i<=M;i++) {
		int u,v;
		scanf("%d %d",&u,&v);
		addedge(u,v,1);
		totm++;
	}
	for(int i=1;i<=N;i++)
		if(d[i]%2)
			addedge(0,i,0),totm++;
	int num=M;
	for(int i=0;i<=N;i++) {
		tmp.clear();
		EulerPath(i);
		for(int j=1;j<tmp.size();j+=2) {
			int id=tmp[j];
			if(e[id].typ==0)
				del[id]=true;
			else {
				int bck=j-1;
				if(bck<0)bck=tmp.size()-1;
				int t=tmp[bck];
				if(e[t].typ==0&&del[t]==false) {
					del[t]=true;
					continue;
				}
				int nxt=j+1;
				if(nxt>=tmp.size())nxt=0;
				t=tmp[nxt];
				if(e[t].typ==0&&del[t]==false) {
					del[t]=true;
					continue;
				}
				del[id]=true;
				num--;
			}
		}
	}
	printf("%d\n",num);
	for(int i=0;i<e.size();i++)
		if(del[i]==false&&e[i].typ==1)
			printf("%d %d\n",e[i].u,e[i].v);
	return 0;
}


#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;

const int Maxn=1e6;

int N,M,totm;
int d[Maxn+5];

struct Node {
	int to;
	int id;
};
vector<Node> G[Maxn+5];
struct Edge {
	int u,v;
	int typ;
};
vector<Edge> e;
void addedge(int u,int v,int typ) {
	e.push_back(Edge{u,v,typ});
	G[u].push_back(Node{v,totm});
	G[v].push_back(Node{u,totm});
	if(typ)d[u]++,d[v]++;
}

bool vis[Maxn*2+5],del[Maxn*2+5];
vector<int> tmp;

void EulerPath(int u) {
	for(int i=0;i<G[u].size();i++) {
		int v=G[u][i].to,id=G[u][i].id;
		if(vis[id])continue;
		tmp.push_back(id);
		vis[id]=true;
		EulerPath(v);
	}
}

int main() {
	#ifdef LOACL
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	scanf("%d %d",&N,&M);
	for(int i=1;i<=M;i++) {
		int u,v;
		scanf("%d %d",&u,&v);
		addedge(u,v,1);
		totm++;
	}
	for(int i=1;i<=N;i++)
		if(d[i]%2)
			addedge(0,i,0),totm++;
	int num=M;
	for(int i=0;i<=N;i++) {
		tmp.clear();
		EulerPath(i);
		for(int j=0;j<tmp.size();j+=2) {
			int id=tmp[j];
			if(e[id].typ==0)
				del[id]=true;
			else {
				int bck=tmp[j-1];
				if(bck<0)bck=tmp.size()-1;
				int t=tmp[bck];
				if(e[t].typ==0&&del[t]==false) {
					del[t]=true;
					continue;
				}
				int nxt=j+1;
				if(nxt>=tmp.size())nxt=0;
				t=tmp[nxt];
				if(e[t].typ==0&&del[t]==false) {
					del[t]=true;
					continue;
				}
				del[id]=true;
				num--;
			}
		}
	}
	printf("%d\n",num);
	for(int i=0;i<e.size();i++)
		if(del[i]==false&&e[i].typ==1)
			printf("%d %d\n",e[i].u,e[i].v);
	return 0;
}


#include<stack>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;

const int Maxn=1e6;

int N,M,totm;
int d[Maxn+5];

struct Node {
	int to;
	int id;
};
vector<Node> G[Maxn+5];
struct Edge {
	int u,v;
	int typ;
};
vector<Edge> e;
void addedge(int u,int v,int typ) {
	e.push_back(Edge{u,v,typ});
	G[u].push_back(Node{v,totm});
	G[v].push_back(Node{u,totm});
	if(typ)d[u]++,d[v]++;
}

bool vis[Maxn*2+5],del[Maxn*2+5];
vector<int> tmp;
int S[Maxn+5];
/*
void EulerPath(int u) {
	for(int i=0;i<G[u].size();i++) {
		int v=G[u][i].to,id=G[u][i].id;
		if(vis[id])continue;
		tmp.push_back(id);
		vis[id]=true;
		EulerPath(v);
	}
}*/
int stk[Maxn+5],ed[Maxn+5],top;
void EulerPath(int s) {
	stk[++top]=s;
	while(top>0) {
		int u=stk[top],v=-1,i;
		for(i=S[u];i<G[u].size();i++)
			if(!vis[G[u][i].id]) {
				v=G[u][i].to;
				break;
			}
		if(i<G[u].size()) {
			stk[++top]=v;
			ed[top]=G[u][i].id;
			vis[G[u][i].id]=true;
			S[u]=i+1;
		} else {
			tmp.push_back(ed[top--]);
		}
	}
}

int main() {
	#ifdef LOACL
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	scanf("%d %d",&N,&M);
	for(int i=1;i<=M;i++) {
		int u,v;
		scanf("%d %d",&u,&v);
		addedge(u,v,1);
		totm++;
	}
	for(int i=1;i<=N;i++)
		if(d[i]%2)
			addedge(0,i,0),totm++;
	int num=M;
	for(int i=0;i<=N;i++) {
		tmp.clear();
		EulerPath(i);
		for(int j=1;j<tmp.size();j+=2) {
			int id=tmp[j];
			if(e[id].typ==0)
				del[id]=true;
			else {
				int bck=j-1;
				if(bck<0)bck=tmp.size()-1;
				int t=tmp[bck];
				if(e[t].typ==0&&del[t]==false) {
					del[t]=true;
					continue;
				}
				int nxt=j+1;
				if(nxt>=tmp.size())nxt=0;
				t=tmp[nxt];
				if(e[t].typ==0&&del[t]==false) {
					del[t]=true;
					continue;
				}
				del[id]=true;
				num--;
			}
		}
	}
	printf("%d\n",num);
	for(int i=0;i<e.size();i++)
		if(del[i]==false&&e[i].typ==1)
			printf("%d %d\n",e[i].u,e[i].v);
	return 0;
}


#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;

const int Maxn=1e6;

int N,M,totm;
int d[Maxn+5];

struct Node {
	int to;
	int id;
};
vector<Node> G[Maxn+5];
struct Edge {
	int u,v;
	int typ;
}e[Maxn*2+5];
void addedge(int u,int v,int typ) {
	G[u].push_back(Node{v,++totm});
	G[v].push_back(Node{u,totm});
	e[totm]=Edge{u,v,typ};
}

bool vis[Maxn*2+5],del[Maxn*2+5];
int tmp[Maxn*2+5],cnt;
int S[Maxn+5];
int stk[Maxn*2+5],ed[Maxn*2+5],top;
void EulerPath(int s) {
	cnt=0,stk[++top]=s;
	while(top>0) {
		int u=stk[top],i;
		for(i=S[u];i<G[u].size();i++)
			if(!vis[G[u][i].id])
				break;
		if(i<G[u].size()) {
			stk[++top]=G[u][i].to;
			ed[top]=G[u][i].id;
			vis[G[u][i].id]=true;
			S[u]=i+1;
		} else tmp[++cnt]=ed[top--];
	}
}

int main() {
	#ifdef LOACL
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	scanf("%d %d",&N,&M);
	for(int i=1;i<=M;i++) {
		int u,v;
		scanf("%d %d",&u,&v);
		addedge(u,v,1);
		d[u]++,d[v]++;
	}
	for(int i=1;i<=N;i++)
		if(d[i]%2)
			addedge(0,i,0);
	int num=M;
	for(int i=0;i<=N;i++) {
		EulerPath(i);
		for(int j=2;j<=cnt;j+=2) {
			int id=tmp[j];
			if(e[id].typ==0)
				del[id]=true;
			else {
				int t=tmp[j-1];
				if(e[t].typ==0&&del[t]==false) {
					del[t]=true;
					continue;
				}
				t=tmp[j%cnt+1];
				if(e[t].typ==0&&del[t]==false) {
					del[t]=true;
					continue;
				}
				del[id]=true;
				num--;
			}
		}
	}
	printf("%d\n",num);
	for(int i=1;i<=totm;i++)
		if(del[i]==false&&e[i].typ==1)
			printf("%d %d\n",e[i].u,e[i].v);
	return 0;
}


#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;

const int Maxn=1e6;

int N,M,totm;
int d[Maxn+5];

struct Node {
	int to;
	int id;
};
vector<Node> G[Maxn+5];
struct Edge {
	int u,v;
	int typ;
};
vector<Edge> e;
void addedge(int u,int v,int typ) {
	e.push_back(Edge{u,v,typ});
	G[u].push_back(Node{v,totm});
	G[v].push_back(Node{u,totm});
	if(typ)d[u]++,d[v]++;
}

bool vis[Maxn*2+5],del[Maxn*2+5];
vector<int> tmp;

void EulerPath(int u) {
	for(int i=0;i<G[u].size();i++) {
		int v=G[u][i].to,id=G[u][i].id;
		if(vis[id])continue;
		tmp.push_back(id);
		vis[id]=true;
		EulerPath(v);
	}
}

int main() {
	#ifdef LOACL
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	scanf("%d %d",&N,&M);
	for(int i=1;i<=M;i++) {
		int u,v;
		scanf("%d %d",&u,&v);
		addedge(u,v,1);
		totm++;
	}
	for(int i=1;i<=N;i++)
		if(d[i]%2)
			addedge(0,i,0),totm++;
	int num=M;
	for(int i=0;i<=N;i++) {
		tmp.clear();
		EulerPath(i);
		for(int j=1;j<tmp.size();j+=2) {
			int id=tmp[j];
			if(e[id].typ==0)
				del[id]=true;
			else {
				int t=tmp[j-1];
				if(e[t].typ==0&&del[t]==false) {
					del[t]=true;
					continue;
				}
				int nxt=j+1;
				if(nxt>=tmp.size())nxt=0;
				t=tmp[nxt];
				if(e[t].typ==0&&del[t]==false) {
					del[t]=true;
					continue;
				}
				del[id]=true;
				num--;
			}
		}
	}
	printf("%d\n",num);
	for(int i=0;i<e.size();i++)
		if(del[i]==false)
			printf("%d %d\n",e[i].u,e[i].v);
	return 0;
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 1000100;
int n, m;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn], shit[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
set<pii> s;
int id[maxn];

inline void dfs(int u, bool f) {
	while (id[u] < G[u].size()) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		id[u]++;
		if (vis[ind]) continue;
		vis[ind] = 1;
		if (f) {
			if (ind) {
                ans.pb(mp(min(u, v), max(u, v)));
                flag[ind] = 1;
            }
            shit[ind] = 1;
		}
		dfs(v, f ^ 1);
	}
}

void work() {
	n = read(), m = read();
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++;
	}
	vector<int> vec;
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, 0)); G[y].pb(mp(x, 0)); deg[x]++; deg[y]++;
		s.insert(mp(min(x, y), max(x, y)));
	}
	rep(i, 1, n) {
		if (id[i] != G[i].size()) dfs(i, 1);
	}
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
            if (deg[i] - d[i] * 2 > 2) {
                cout<<i<<' '<<d[i]<<' '<<deg[i]<<endl;
                cout<<id[i]<<endl;
                rep(j, 0, G[i].size() - 1) {
                    int ind = G[i][j].se;
                    cout<<shit[ind]<<' '<<ind<<' ';
                }
                exit(0);
            }
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind == -1) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 1000100;
int n, m;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn], shit[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
pii ed[maxn];
int id[maxn], seq[maxn], num;

inline void dfs(int u) {
	for (int &i = id[u]; i < G[u].size(); i++) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		if (vis[ind]) continue;
		vis[ind] = 1; seq[++num] = ind;
        dfs(v);
	}
}

void work() {
	n = read(), m = read();
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++; ed[i] = mp(x, y);
	}
	vector<int> vec; vec.clear();
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, 0)); G[y].pb(mp(x, 0));
        deg[x]++; deg[y]++;
	}
	rep(i, 1, n) dfs(i);
    for (int i = 1; i <= num; i += 2) {
        if (seq[i] > 0) {
            ans.pb(ed[seq[i]]);
            flag[seq[i]] = 1;
        }
    }
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
            if (deg[i] - d[i] * 2 > 2) {
                cout<<i<<' '<<d[i]<<' '<<deg[i]<<endl;
                cout<<id[i]<<endl;
                rep(j, 0, G[i].size() - 1) {
                    int ind = G[i][j].se;
                    cout<<vis[ind]<<' '<<ind<<' ';
                }
                rep(j, 1, num) {
                    if (ed[seq[j]].fi == i || ed[seq[j]].se == i) {
                        cout<<j<<' '<<seq[j]<<endl;
                    }
                }
                exit(0);
            }
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind == -1) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 1000100;
int n, m;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn], shit[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
set<pii> s;
int id[maxn];

inline void dfs(int u, bool f) {
	while (id[u] < G[u].size()) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		id[u]++;
		if (vis[ind]) continue;
		vis[ind] = 1;
		if (f) {
			if (ind) {
                ans.pb(mp(min(u, v), max(u, v)));
                flag[ind] = 1;
            }
            shit[ind] = 1;
            if (m == n) if (u == 111 || v == 111) cout<<u<<' '<<v<<' '<<ind<<endl;
		}
		dfs(v, f ^ 1);
	}
}

void work() {
	n = read(), m = read();
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++;
	}
	vector<int> vec;
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, 0)); G[y].pb(mp(x, 0)); deg[x]++; deg[y]++;
		s.insert(mp(min(x, y), max(x, y)));
	}
	rep(i, 1, n) {
		if (id[i] != G[i].size()) dfs(i, 1);
	}
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
            if (deg[i] - d[i] * 2 > 2) {
                cout<<i<<' '<<d[i]<<' '<<deg[i]<<endl;
                cout<<id[i]<<endl;
                rep(j, 0, G[i].size() - 1) {
                    int ind = G[i][j].se;
                    cout<<shit[ind]<<' '<<ind<<' ';
                }
                exit(0);
            }
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind == -1) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 1000100;
int n, m;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn], shit[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
set<pii> s;
int id[maxn];

inline void dfs(int u, bool f) {
	while (id[u] < G[u].size()) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		id[u]++;
		if (vis[ind]) continue;
		vis[ind] = 1;
		if (f) {
			if (ind) {
                ans.pb(mp(min(u, v), max(u, v)));
                flag[ind] = 1;
            }
            shit[ind] = 1;
            if (m == n) if (u == 111 || v == 111) cout<<u<<' '<<v<<' '<<ind<<endl;
		}
		dfs(v, f ^ 1);
        break;
	}
}

void work() {
	n = read(), m = read();
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++;
	}
	vector<int> vec;
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, 0)); G[y].pb(mp(x, 0)); deg[x]++; deg[y]++;
		s.insert(mp(min(x, y), max(x, y)));
	}
	rep(i, 1, n) {
		if (id[i] != G[i].size()) dfs(i, 1);
	}
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
            if (deg[i] - d[i] * 2 > 2) {
                cout<<i<<' '<<d[i]<<' '<<deg[i]<<endl;
                cout<<id[i]<<endl;
                rep(j, 0, G[i].size() - 1) {
                    int ind = G[i][j].se;
                    cout<<shit[ind]<<' '<<ind<<' ';
                }
                exit(0);
            }
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind == -1) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 1000100;
int n, m;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn], shit[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
set<pii> s;
int id[maxn];

inline void dfs(int u, bool f) {
	while (id[u] < G[u].size()) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		id[u]++;
		if (vis[ind]) continue;
		vis[ind] = 1;
		if (f) {
			if (ind) {
                ans.pb(mp(min(u, v), max(u, v)));
                flag[ind] = 1;
            }
            shit[ind] = 1;
		}
		dfs(v, f ^ 1);
	}
}

void work() {
	n = read(), m = read();
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++;
	}
	vector<int> vec;
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, 0)); G[y].pb(mp(x, 0)); deg[x]++; deg[y]++;
		s.insert(mp(min(x, y), max(x, y)));
	}
	rep(i, 1, n) {
		if (id[i] != G[i].size()) dfs(i, 1);
	}
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
            if (deg[i] - d[i] * 2 > 2) {
                cout<<i<<' '<<d[i]<<' '<<deg[i]<<endl;
                rep(j, 0, G[i].size() - 1) {
                    int ind = G[i][j].se;
                    cout<<shit[ind]<<' '<<ind<<' ';
                }
                exit(0);
            }
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind == -1) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 2000200;
int n, m, NW;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn], shit[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
pii ed[maxn];
int id[maxn], seq[maxn], num;

inline void dfs(int u) {
	for (int &i = id[u]; i < G[u].size(); i++) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		if (vis[ind]) continue;
		vis[ind] = 1; seq[++num] = ind;
        if (n == 1000 && m == 1000) {
            if (u == 650 || v == 650) cout<<u<<' '<<v<<' '<<num<<' '<<ind<<' '<<NW<<"--";
        }
        dfs(v);
	}
}

void work() {
	n = read(), m = read(); int tm = m;
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++; ed[i] = mp(x, y);
	}
	vector<int> vec; vec.clear();
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, ++m)); G[y].pb(mp(x, m));
        deg[x]++; deg[y]++; ed[m] = mp(x, y);
	}
    m = tm;
	rep(i, 1, n) {
        num = 0;
        NW = i;
        dfs(i);
        for (int j = 1; j <= num; j += 2) {
            if (seq[j] <= m) {
                ans.pb(ed[seq[j]]);
                flag[seq[j]] = 1;
            }
        }
    }
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
            if (deg[i] - d[i] * 2 > 2) {
                cout<<i<<' '<<d[i]<<' '<<deg[i]<<endl;
                cout<<id[i]<<endl;
                rep(j, 0, G[i].size() - 1) {
                    int ind = G[i][j].se;
                    cout<<vis[ind]<<' '<<ind<<' '<<flag[ind]<<"    ";
                }
                exit(0);
            }
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind > m) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 1000100;
int n, m;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
set<pii> s;
int id[maxn];

inline void dfs(int u, bool f) {
	while (id[u] < G[u].size()) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		id[u]++;
		if (vis[ind]) continue;
		vis[ind] = 1;
		if (f) {
			if (ind) ans.pb(mp(min(u, v), max(u, v)));
		}
		dfs(v, f ^ 1);
	}
}

void work() {
	n = read(), m = read();
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++;
	}
	vector<int> vec;
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x, y;
		if (i == vec.size() - 1) x = vec[i], y = vec[0];
		else x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, 0)); G[y].pb(mp(x, 0)); deg[x]++; deg[y]++;
		s.insert(mp(min(x, y), max(x, y)));
	}
	rep(i, 1, n) {
		if (id[i] != G[i].size()) dfs(i, 1);
	}
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind == -1) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 2000200;
int n, m, NW;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn], shit[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
pii ed[maxn];
int id[maxn], seq[maxn], num;

inline void dfs(int u) {
	for (int &i = id[u]; i < G[u].size(); i++) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		if (vis[ind]) continue;
		vis[ind] = 1; seq[++num] = ind;
        // if (n == 1000 && m == 1000) {
            // if (u == 650 || v == 650) cout<<u<<' '<<v<<' '<<num<<' '<<ind<<' '<<NW<<"--";
        // }
        dfs(v);
        break;
	}
}

void work() {
	n = read(), m = read(); int tm = m;
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++; ed[i] = mp(x, y);
	}
	vector<int> vec; vec.clear();
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, ++m)); G[y].pb(mp(x, m));
        deg[x]++; deg[y]++; ed[m] = mp(x, y);
	}
    m = tm;
	rep(i, 1, n) {
        num = 0;
        NW = i;
        dfs(i);
        for (int j = 1; j <= num; j += 2) {
            if (seq[j] <= m) {
                ans.pb(ed[seq[j]]);
                flag[seq[j]] = 1;
            }
        }
    }
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
            if (deg[i] - d[i] * 2 > 2) {
                cout<<i<<' '<<d[i]<<' '<<deg[i]<<endl;
                cout<<id[i]<<endl;
                rep(j, 0, G[i].size() - 1) {
                    int ind = G[i][j].se;
                    cout<<vis[ind]<<' '<<ind<<' '<<flag[ind]<<"    ";
                }
                exit(0);
            }
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind > m) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 1000100;
int n, m;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
set<pii> s;
int id[maxn];

inline void dfs(int u, bool f) {
	while (id[u] < G[u].size()) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		id[u]++;
		if (vis[ind]) continue;
		vis[ind] = 1;
		if (f) {
			if (ind) {
                ans.pb(mp(min(u, v), max(u, v)));
                flag[ind] = 1;
            }
		}
		dfs(v, f ^ 1);
	}
}

void work() {
	n = read(), m = read();
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++;
	}
	vector<int> vec;
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x, y;
		if (i == vec.size() - 1) x = vec[i], y = vec[0];
		else x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, 0)); G[y].pb(mp(x, 0)); deg[x]++; deg[y]++;
		s.insert(mp(min(x, y), max(x, y)));
	}
	rep(i, 1, n) {
		if (id[i] != G[i].size()) dfs(i, 1);
	}
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind == -1) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 2000200;
int n, m, NW;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn], shit[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
pii ed[maxn];
int id[maxn], seq[maxn], num;

inline void dfs(int u) {
	for (int &i = id[u]; i < G[u].size(); i++) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		if (vis[ind]) continue;
		vis[ind] = 1; seq[++num] = ind;
        if (n == 1000 && m == 1000) {
            if (u == 650 || v == 650) cout<<u<<' '<<v<<' '<<num<<' '<<ind<<' '<<NW<<"--";
        }
        dfs(v);
        break;
	}
}

void work() {
	n = read(), m = read(); int tm = m;
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++; ed[i] = mp(x, y);
	}
	vector<int> vec; vec.clear();
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, ++m)); G[y].pb(mp(x, m));
        deg[x]++; deg[y]++; ed[m] = mp(x, y);
	}
    m = tm;
	rep(i, 1, n) {
        num = 0;
        NW = i;
        dfs(i);
        for (int j = 1; j <= num; j += 2) {
            if (seq[j] <= m) {
                ans.pb(ed[seq[j]]);
                flag[seq[j]] = 1;
            }
        }
    }
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
            if (deg[i] - d[i] * 2 > 2) {
                cout<<i<<' '<<d[i]<<' '<<deg[i]<<endl;
                cout<<id[i]<<endl;
                rep(j, 0, G[i].size() - 1) {
                    int ind = G[i][j].se;
                    cout<<vis[ind]<<' '<<ind<<' '<<flag[ind]<<"    ";
                }
                exit(0);
            }
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind > m) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 2000200;
int n, m;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn], shit[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
pii ed[maxn];
int id[maxn], seq[maxn], num;

inline void dfs(int u) {
	for (int &i = id[u]; i < G[u].size(); i++) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		if (vis[ind]) continue;
		vis[ind] = 1; seq[++num] = ind;
        if (n == 1000 && m == 1000) {
            if (u == 650 || v == 650) cout<<u<<' '<<v<<' '<<num<<"    ";
        }
        dfs(v);
	}
}

void work() {
	n = read(), m = read(); int tm = m;
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++; ed[i] = mp(x, y);
	}
	vector<int> vec; vec.clear();
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, ++m)); G[y].pb(mp(x, m));
        deg[x]++; deg[y]++; ed[m] = mp(x, y);
	}
    m = tm;
	rep(i, 1, n) dfs(i);
    if (n == 1e6 && m == 1e6) puts("");
    for (int i = 1; i <= num; i += 2) {
        if (seq[i] <= m) {
            ans.pb(ed[seq[i]]);
            flag[seq[i]] = 1;
        }
    }
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
            if (deg[i] - d[i] * 2 > 2) {
                cout<<i<<' '<<d[i]<<' '<<deg[i]<<endl;
                cout<<id[i]<<endl;
                rep(j, 0, G[i].size() - 1) {
                    int ind = G[i][j].se;
                    cout<<vis[ind]<<' '<<ind<<' '<<flag[ind]<<"    ";
                }
                exit(0);
            }
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind > m) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 2000200;
int n, m;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn], shit[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
pii ed[maxn];
int id[maxn], seq[maxn], num;

inline void dfs(int u) {
	for (int &i = id[u]; i < G[u].size(); i++) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		if (vis[ind]) continue;
		vis[ind] = 1; seq[++num] = ind;
        if (n == 1e6 && m == 1e6) {
            if (u == 38 || v == 38) cout<<u<<' '<<v<<' '<<num<<"    ";
        }
        dfs(v);
	}
}

void work() {
	n = read(), m = read(); int tm = m;
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++; ed[i] = mp(x, y);
	}
	vector<int> vec; vec.clear();
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, ++m)); G[y].pb(mp(x, m));
        deg[x]++; deg[y]++; ed[m] = mp(x, y);
	}
    m = tm;
	rep(i, 1, n) dfs(i);
    if (n == 1e6 && m == 1e6) puts("");
    for (int i = 1; i <= num; i += 2) {
        if (seq[i] <= m) {
            ans.pb(ed[seq[i]]);
            flag[seq[i]] = 1;
        }
    }
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
            if (deg[i] - d[i] * 2 > 2) {
                cout<<i<<' '<<d[i]<<' '<<deg[i]<<endl;
                cout<<id[i]<<endl;
                rep(j, 0, G[i].size() - 1) {
                    int ind = G[i][j].se;
                    cout<<vis[ind]<<' '<<ind<<' ';
                }
                exit(0);
            }
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind > m) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 1000100;
int n, m;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn], shit[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
set<pii> s;
int id[maxn];

inline void dfs(int u, bool f) {
	if (id[u] < G[u].size()) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		id[u]++;
		if (vis[ind]) continue;
		vis[ind] = 1;
		if (f) {
			if (ind) {
                ans.pb(mp(min(u, v), max(u, v)));
                flag[ind] = 1;
            }
            shit[ind] = 1;
            if (m == n) if (u == 111 || v == 111) cout<<u<<' '<<v<<' '<<ind<<endl;
		}
		dfs(v, f ^ 1);
	}
}

void work() {
	n = read(), m = read();
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++;
	}
	vector<int> vec;
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, 0)); G[y].pb(mp(x, 0)); deg[x]++; deg[y]++;
		s.insert(mp(min(x, y), max(x, y)));
	}
	rep(i, 1, n) {
		if (id[i] != G[i].size()) dfs(i, 1);
	}
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
            if (deg[i] - d[i] * 2 > 2) {
                cout<<i<<' '<<d[i]<<' '<<deg[i]<<endl;
                cout<<id[i]<<endl;
                rep(j, 0, G[i].size() - 1) {
                    int ind = G[i][j].se;
                    cout<<shit[ind]<<' '<<ind<<' ';
                }
                exit(0);
            }
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind == -1) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 1000100;
int n, m;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
set<pii> s;
int id[maxn];

inline void dfs(int u, bool f) {
	while (id[u] < G[u].size()) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		id[u]++;
		if (vis[ind]) continue;
		vis[ind] = 1;
		if (f) {
			if (ind) {
                ans.pb(mp(min(u, v), max(u, v)));
                flag[ind] = 1;
            }
		}
		dfs(v, f ^ 1);
	}
}

void work() {
	n = read(), m = read();
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++;
	}
	vector<int> vec;
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x, y;
		if (i == vec.size() - 1) x = vec[i], y = vec[0];
		else x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, 0)); G[y].pb(mp(x, 0)); deg[x]++; deg[y]++;
		s.insert(mp(min(x, y), max(x, y)));
	}
	rep(i, 1, n) {
		if (id[i] != G[i].size()) dfs(i, 1);
	}
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
            if (deg[i] - d[i] * 2 > 2) {
                cout<<i<<' '<<d[i]<<' '<<deg[i]<<endl;
                puts("shit");
                while(1);
            }
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind == -1) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 2000200;
int n, m;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn], shit[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
pii ed[maxn];
int id[maxn], seq[maxn], num;

inline void dfs(int u) {
	for (int &i = id[u]; i < G[u].size(); i++) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		if (vis[ind]) continue;
		vis[ind] = 1; seq[++num] = ind;
        if (n == 1000 && m == 1000) {
            if (u == 650 || v == 650) cout<<u<<' '<<v<<' '<<num<<' '<<ind<<"    ";
        }
        dfs(v);
	}
}

void work() {
	n = read(), m = read(); int tm = m;
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++; ed[i] = mp(x, y);
	}
	vector<int> vec; vec.clear();
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, ++m)); G[y].pb(mp(x, m));
        deg[x]++; deg[y]++; ed[m] = mp(x, y);
	}
    m = tm;
	rep(i, 1, n) {
        num = 0;
        dfs(i);
        for (int j = 1; j <= num; j += 2) {
            if (seq[j] <= m) {
                ans.pb(ed[seq[j]]);
                flag[seq[j]] = 1;
            }
        }
    }
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
            if (deg[i] - d[i] * 2 > 2) {
                cout<<i<<' '<<d[i]<<' '<<deg[i]<<endl;
                cout<<id[i]<<endl;
                rep(j, 0, G[i].size() - 1) {
                    int ind = G[i][j].se;
                    cout<<vis[ind]<<' '<<ind<<' '<<flag[ind]<<"    ";
                }
                exit(0);
            }
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind > m) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 1000100;
int n, m;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
set<pii> s;
int id[maxn];

inline void dfs(int u, bool f) {
	while (id[u] < G[u].size()) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		id[u]++;
		if (vis[ind]) continue;
		vis[ind] = 1;
		if (f) {
			if (ind) {
                ans.pb(mp(min(u, v), max(u, v)));
                flag[ind] = 1;
            }
		}
		dfs(v, f ^ 1);
	}
}

void work() {
	n = read(), m = read();
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++;
	}
	vector<int> vec;
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x, y;
		if (i == vec.size() - 1) x = vec[i], y = vec[0];
		else x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, 0)); G[y].pb(mp(x, 0)); deg[x]++; deg[y]++;
		s.insert(mp(min(x, y), max(x, y)));
	}
	rep(i, 1, n) {
		if (id[i] != G[i].size()) dfs(i, 1);
	}
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
            if (deg[i] - d[i] * 2 > 1) {
                puts("shit");
                while(1);
            }
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind == -1) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 2000200;
int n, m, NW;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn], shit[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
pii ed[maxn];
int id[maxn], seq[maxn], num;

inline void dfs(int u) {
	for (int &i = id[u]; i < G[u].size(); i++) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		if (vis[ind]) continue;
		vis[ind] = 1; seq[++num] = ind;
        dfs(v);
        break;
	}
}

void work() {
	n = read(), m = read(); int tm = m;
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++; ed[i] = mp(x, y);
	}
	vector<int> vec; vec.clear();
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, ++m)); G[y].pb(mp(x, m));
        deg[x]++; deg[y]++; ed[m] = mp(x, y);
	}
    m = tm;
	rep(i, 1, n) {
        num = 0;
        NW = i;
        dfs(i);
        for (int j = 1; j <= num; j += 2) {
            if (seq[j] <= m) {
                ans.pb(ed[seq[j]]);
                flag[seq[j]] = 1;
            }
        }
    }
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind > m) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 1000100;
int n, m;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn], shit[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
pii ed[maxn];
int id[maxn], seq[maxn], num;

inline void dfs(int u) {
	for (int &i = id[u]; i < G[u].size(); i++) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		if (vis[ind]) continue;
		vis[ind] = 1; seq[++num] = ind;
        dfs(v);
	}
}

void work() {
	n = read(), m = read();
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++; ed[i] = mp(x, y);
	}
	vector<int> vec; vec.clear();
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, 0)); G[y].pb(mp(x, 0));
        deg[x]++; deg[y]++;
	}
	rep(i, 1, n) dfs(i);
    for (int i = 1; i <= num; i += 2) {
        if (seq[i] > 0) {
            ans.pb(ed[seq[i]]);
            flag[seq[i]] = 1;
        }
    }
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
            if (deg[i] - d[i] * 2 > 2) {
                cout<<i<<' '<<d[i]<<' '<<deg[i]<<endl;
                cout<<id[i]<<endl;
                rep(j, 0, G[i].size() - 1) {
                    int ind = G[i][j].se;
                    cout<<shit[ind]<<' '<<ind<<' ';
                }
                exit(0);
            }
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind == -1) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 2000200;
int n, m;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn], shit[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
pii ed[maxn];
int id[maxn], seq[maxn], num;

inline void dfs(int u) {
	for (int &i = id[u]; i < G[u].size(); i++) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		if (vis[ind]) continue;
		vis[ind] = 1; seq[++num] = ind;
        // if (n == 1e6 && m == 1e6) {
            // if (u == 38 || v == 38) cout<<u<<' '<<v<<' '<<num<<"    ";
        // }
        dfs(v);
	}
}

void work() {
	n = read(), m = read(); int tm = m;
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++; ed[i] = mp(x, y);
	}
	vector<int> vec; vec.clear();
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, ++m)); G[y].pb(mp(x, m));
        deg[x]++; deg[y]++; ed[m] = mp(x, y);
	}
    m = tm;
	rep(i, 1, n) dfs(i);
    if (n == 1e6 && m == 1e6) puts("");
    for (int i = 1; i <= num; i += 2) {
        if (seq[i] <= m) {
            ans.pb(ed[seq[i]]);
            flag[seq[i]] = 1;
        }
    }
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
            if (deg[i] - d[i] * 2 > 2) {
                cout<<i<<' '<<d[i]<<' '<<deg[i]<<endl;
                cout<<id[i]<<endl;
                rep(j, 0, G[i].size() - 1) {
                    int ind = G[i][j].se;
                    cout<<vis[ind]<<' '<<ind<<' ';
                }
                exit(0);
            }
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind > m) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 1000100;
int n, m;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn], shit[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
set<pii> s;
int id[maxn];

inline void dfs(int u, bool f) {
	while (id[u] < G[u].size()) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		id[u]++;
		if (vis[ind]) continue;
		vis[ind] = 1;
		if (f) {
			if (ind) {
                ans.pb(mp(min(u, v), max(u, v)));
                flag[ind] = 1;
            }
            shit[ind] = 1;
            if (u == 111 || v == 111) cout<<u<<' '<<v<<' '<<ind<<endl;
		}
		dfs(v, f ^ 1);
	}
}

void work() {
	n = read(), m = read();
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++;
	}
	vector<int> vec;
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, 0)); G[y].pb(mp(x, 0)); deg[x]++; deg[y]++;
		s.insert(mp(min(x, y), max(x, y)));
	}
	rep(i, 1, n) {
		if (id[i] != G[i].size()) dfs(i, 1);
	}
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
            if (deg[i] - d[i] * 2 > 2) {
                cout<<i<<' '<<d[i]<<' '<<deg[i]<<endl;
                cout<<id[i]<<endl;
                rep(j, 0, G[i].size() - 1) {
                    int ind = G[i][j].se;
                    cout<<shit[ind]<<' '<<ind<<' ';
                }
                exit(0);
            }
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind == -1) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 2000200;
int n, m;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn], shit[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
pii ed[maxn];
int id[maxn], seq[maxn], num;

inline void dfs(int u) {
	for (int &i = id[u]; i < G[u].size(); i++) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		if (vis[ind]) continue;
		vis[ind] = 1; seq[++num] = ind;
        if (n == 1000 && m == 1000) {
            if (u == 650 || v == 650) cout<<u<<' '<<v<<' '<<num<<' '<<ind<<"    ";
        }
        dfs(v);
	}
}

void work() {
	n = read(), m = read(); int tm = m;
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++; ed[i] = mp(x, y);
	}
	vector<int> vec; vec.clear();
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, ++m)); G[y].pb(mp(x, m));
        deg[x]++; deg[y]++; ed[m] = mp(x, y);
	}
    m = tm;
	rep(i, 1, n) dfs(i);
    for (int i = 1; i <= num; i += 2) {
        if (seq[i] <= m) {
            ans.pb(ed[seq[i]]);
            flag[seq[i]] = 1;
        }
    }
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
            if (deg[i] - d[i] * 2 > 2) {
                cout<<i<<' '<<d[i]<<' '<<deg[i]<<endl;
                cout<<id[i]<<endl;
                rep(j, 0, G[i].size() - 1) {
                    int ind = G[i][j].se;
                    cout<<vis[ind]<<' '<<ind<<' '<<flag[ind]<<"    ";
                }
                exit(0);
            }
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind > m) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 1000100;
int n, m;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn], shit[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
pii ed[maxn];
int id[maxn], seq[maxn], num;

inline void dfs(int u) {
	for (int &i = id[u]; i < G[u].size(); i++) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		if (vis[ind]) continue;
		vis[ind] = 1; seq[++num] = ind;
        if (n == 1e6 && m == 1e6) {
            if (i == 38 || v == 38) cout<<i<<' '<<v<<' '<<num<<"    ";
        }
        dfs(v);
	}
}

void work() {
	n = read(), m = read();
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++; ed[i] = mp(x, y);
	}
	vector<int> vec; vec.clear();
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, 0)); G[y].pb(mp(x, 0));
        deg[x]++; deg[y]++;
	}
	rep(i, 1, n) dfs(i);
    if (n == 1e6 && m == 1e6) puts("");
    for (int i = 1; i <= num; i += 2) {
        if (seq[i] > 0) {
            ans.pb(ed[seq[i]]);
            flag[seq[i]] = 1;
        }
    }
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
            if (deg[i] - d[i] * 2 > 2) {
                cout<<i<<' '<<d[i]<<' '<<deg[i]<<endl;
                cout<<id[i]<<endl;
                rep(j, 0, G[i].size() - 1) {
                    int ind = G[i][j].se;
                    cout<<vis[ind]<<' '<<ind<<' ';
                }
                exit(0);
            }
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind == -1) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 2000200;
int n, m;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn], shit[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
pii ed[maxn];
int id[maxn], seq[maxn], num;

inline void dfs(int u) {
	for (int &i = id[u]; i < G[u].size(); i++) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		if (vis[ind]) continue;
		vis[ind] = 1; seq[++num] = ind;
        if (n == 1e6 && m == 1e6) {
            if (u == 38 || v == 38) cout<<u<<' '<<v<<' '<<num<<"    ";
        }
        dfs(v);
	}
}

void work() {
	n = read(), m = read(); int tm = m;
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++; ed[i] = mp(x, y);
	}
	vector<int> vec; vec.clear();
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, ++m)); G[y].pb(mp(x, m));
        deg[x]++; deg[y]++;
	}
    m = tm;
	rep(i, 1, n) dfs(i);
    if (n == 1e6 && m == 1e6) puts("");
    for (int i = 1; i <= num; i += 2) {
        if (seq[i] > 0) {
            ans.pb(ed[seq[i]]);
            flag[seq[i]] = 1;
        }
    }
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
            if (deg[i] - d[i] * 2 > 2) {
                cout<<i<<' '<<d[i]<<' '<<deg[i]<<endl;
                cout<<id[i]<<endl;
                rep(j, 0, G[i].size() - 1) {
                    int ind = G[i][j].se;
                    cout<<vis[ind]<<' '<<ind<<' ';
                }
                exit(0);
            }
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind > m) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}


// Copyright: lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int maxn = 1000100;
int n, m;
vector<pii> G[maxn];
bool vis[maxn], flag[maxn], shit[maxn];
int deg[maxn], d[maxn];
vector<pii> ans;
pii ed[maxn];
int id[maxn], seq[maxn], num;

inline void dfs(int u) {
	for (int &i = id[u]; i < G[u].size(); i++) {
		int v = G[u][id[u]].fi; int ind = G[u][id[u]].se;
		if (vis[ind]) continue;
		vis[ind] = 1; seq[++num] = ind;
        if (n == 1e6 && m == 1e6) {
            if (u == 38 || v == 38) cout<<u<<' '<<v<<' '<<num<<"    ";
        }
        dfs(v);
	}
}

void work() {
	n = read(), m = read();
	rep(i, 1, m) {
		int x = read(),  y = read();
		G[x].pb(mp(y, i)); G[y].pb(mp(x, i));
		deg[x]++; deg[y]++; ed[i] = mp(x, y);
	}
	vector<int> vec; vec.clear();
	rep(i, 1, n) if (deg[i] & 1) vec.pb(i);
	for (int i = 0; i < vec.size(); i += 2) {
		int x = vec[i], y = vec[i + 1];
		G[x].pb(mp(y, 0)); G[y].pb(mp(x, 0));
        deg[x]++; deg[y]++;
	}
	rep(i, 1, n) dfs(i);
    if (n == 1e6 && m == 1e6) puts("");
    for (int i = 1; i <= num; i += 2) {
        if (seq[i] > 0) {
            ans.pb(ed[seq[i]]);
            flag[seq[i]] = 1;
        }
    }
	int cnt = 0;
	rep(i, 0, ans.size() - 1) {
		cnt++; d[ans[i].fi]++; d[ans[i].se]++;
	}
	rep(i, 1, n) {
		if (d[i] * 2 < deg[i]) {
            if (deg[i] - d[i] * 2 > 2) {
                cout<<i<<' '<<d[i]<<' '<<deg[i]<<endl;
                cout<<id[i]<<endl;
                rep(j, 0, G[i].size() - 1) {
                    int ind = G[i][j].se;
                    cout<<vis[ind]<<' '<<ind<<' ';
                }
                exit(0);
            }
			rep(j, 0, G[i].size() - 1) {
				int ind = G[i][j].se;
				int v = G[i][j].fi;
				if (ind == -1) continue;
				if (!flag[ind]) {
					flag[ind] = 1;
					d[i]++; d[v]++;
					ans.pb(mp(min(i, v), max(i, v)));
					cnt++; break;
				}
			}
		}
	}
	printf("%d\n", cnt);
	rep(i, 0, ans.size() - 1) {
		printf("%d %d\n", ans[i].fi, ans[i].se);
	}
}

int main(){
	#ifdef LZT
		freopen("in","r",stdin);
	#endif

	work();

	#ifdef LZT
		Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
	#endif
}