#include using namespace std; using ll = long long; const ll MOD = 1000000007; const long long INF = 1LL << 60; #define rep(i,n) for(int i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() int main() { int n, q; cin >> n >> q; vector a; rep(i,q){ int l, r, ans = 0; cin >> l >> r; a.push_back(l); a.push_back(r+1); sort(all(a)); for(int j = 0; j < 2*(i+1); j += 2) ans += a[j+1]-a[j]; cout << ans << endl; } }