#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<stack>
#include<queue>
#include<string.h>
#include<array>
#include<algorithm>
#include<cmath>
using namespace std;
#define ff first
#define ss second
#define endl '\n'
const int maxn = 5e5;
const long long oo = 1e18;
int maxq = 29;
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int l, n;
cin >> l >> n;
vector<pair<int, int>> t;
for(int i = 0; i < n; i++){
int u, v;
cin >> u >> v;
t.push_back({u, v});
}
sort(t.begin(), t.end());
vector<int> dp(n, 1);
for(int i = 0; i < n; i++){
for(int j = 0; j < i; j++){
int L = 1LL * t[j].ss * t[j].ff * t[i].ss + 1LL * l * t[i].ss;
int R = 1LL * t[i].ff * t[j].ss * t[i].ss + 1LL * l * t[j].ss;
if(L > R){
dp[i] = max(dp[i], dp[j] + 1);
}
}
}
cout << *max_element(dp.begin(), dp.end());
}