#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
	int l, n;
	cin >> l >> n;
	vi v(n);
	int sum = 0;
	rep(i, n) {
		int x, w;
		cin >> x >>w;
		sum += x * w;
	}
	if(sum == 0) {
		cout<<0<<endl;
		return 0;
	}
	for(int i = l; i >=1; i--) {
		if(abs(sum) % i == 0) {
			cout<<1<<endl;
			if(sum < 0) cout<<i<<" "<<abs(sum)/i<<endl;
			else cout<<-i<<" " << sum / i<<endl;
			return 0;
		}
	}
}