#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2")
#include <bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for (int i = (a); i <= (b); ++i)

void setIO(const string& s) {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
#ifndef ONLINE_JUDGE
    freopen((s+".in").c_str(),"r",stdin);
//	freopen((s+".out").c_str(),"w",stdout);
#endif
}

const int N = 2010;

int L[N], R[N];

signed main() {
    setIO("input");

    int n,m,k; cin >> n >> m >> k;
    for(int i=1; i<=m; ++i) {
        cin >> L[i] >> R[i];
    }

    int ans = 0;
    for(int i=1; i<=n-k+1; ++i) {
        FOR(j,i,n-k+1) {
            int li = i, ri = i+k-1, lj = j, rj = j+k-1;
            int cur = 0;
            for(int l=1; l<=m; ++l) {
                cur += max(0,max(min(ri,R[l])-max(li,L[l]), min(rj,R[l])-max(lj,L[l]))+1);
            }
            ans = max(ans, cur);
        }
    }
    cout << ans << '\n';

}