#include #define FOR(i,a,b) for (int i = (a); i <= (b); i++) #define FORD(i,a,b) for (int i = (a); i >= (b); i--) #define REP(i,b) for (int i = 0; i < (b); i++) using namespace std; typedef long long ll; void vloz(map > & d, int a, int b){ if(d.find(a) == d.end()) d[a] = set(); d[a].insert(b); } ll solve(const vector& xs, const vector& ys, int m, int n){ map > stlpce; REP(i,n){ vloz(stlpce, xs[i], ys[i]); } ll h = m; map >::iterator st_it = stlpce.begin(); priority_queue q; ll res = -1; while(st_it != stlpce.end()){ ll r = st_it->first; set::iterator add_it = st_it->second.begin(); while(add_it!=st_it->second.end() && *add_it <= h){ q.push(*add_it); add_it++; } while(q.size() > n/2){ h = q.top(); while(!q.empty() && q.top() == h) q.pop(); h--; } if (q.size() == n/2){ ll h_t = q.top(); //cout<<(h_t+1)<< " "<<(r+1)< (h_t+1) * (r+1) || res == -1) { res = (h_t+1) * (r+1); } } st_it++; } return res; } int main() { int n, m; while (scanf("%d", &m) == 1) { scanf("%d", &n); vector xs (n); vector ys (n); REP(i,n) scanf("%d%d", &xs[i], &ys[i]); if(n%2 == 1){ printf("%d\n", -1); continue; } ll res = solve(xs, ys, m, n); //cout<<"#"<