It is confirmed that these sections do not overlap with each other.

一句话 就变成水题了,,,

// by SiriusRen
#include <cstdio>
using namespace std;
int n,m,xx,yy;
int main(){
    while(scanf("%d%d",&n,&m)&&(n||m)){
        n++;
        for(int i=1;i<=m;i++)scanf("%d%d",&xx,&yy),n-=(yy-xx+1);
        printf("%d\n",n);
    }
}