intmain(){ int T; scanf("%d", &T); int kase = 0; while(T--) { int n, m; scanf("%d%d", &n, &m); map<int, int> d; int cnt = 0; for(int i = 1; i <= m; ++i) { int l, r; scanf("%d%d", &l, &r); ++d[l]; --d[r + 1]; } ll ans = 0; auto it = d.begin(); int p = it->first; int v = it->second; ++it; for(; it != d.end(); ++it) { if(v & 1) ans += it->first - p; it->second = v + it->second; p = it->first; v = it->second; } if(v & 1) ans += n - p; printf("Case #%d: %lld\n", ++kase, ans); } return0; }