#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
#define mem(a, b) memset(a, b, sizeof(a))
#define inf 0x3f3f3f3f
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define vi vector<int>
#define X first
#define Y second
#define eps 1e-8
const int maxn = 2e5 + 10;
const int mod = 998244353;
using namespace std;

template<typename T1,typename T2>void ckmin(T1 &a,T2 b){if(a>b)a=b;}
template<typename T1,typename T2>void ckmax(T1 &a,T2 b){if(a<b)a=b;}
template<typename T1,typename T2>void addmo(T1 &a,T2 b){a+=b;if(a>=mod)a-=mod;}

int n,m,k,b[2010][2010],s[2010][2010];
pii a[2010];

void solve(){
    scanf("%d%d%d",&n,&m,&k);
    for(int i=1;i<=m;i++)
        scanf("%d%d",&a[i].first,&a[i].second);
    for(int i=1;i<=n;i++){
        int l=i,r=min(n,i+k-1);
        for(int j=1;j<=m;j++){
            if(a[j].first>r||a[j].second<l)
                b[i][j]=0;
            else 
                b[i][j]=min(r,a[j].second)-max(l,a[j].first)+1;
            // printf("%d\n",b[i][j]);
        }
    }
    ll ans=0;
    for(int i=1;i<=n;i++)for(int j=i;j<=n;j++){ 
        int tt=0;
        for(int t=1;t<=m;t++){
            
            tt+=max(b[i][t],b[j][t]);
            // printf("%d %d")
        }
        ckmax(ans,tt);
    }
    printf("%d\n",ans);
}

signed main(){   
    // int T;
    // scanf("%d",&T);
    // while(T--)
        solve();
    // system("pause");
    return 0;
}
