#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")
//#pragma GCC target("avx,avx2,sse,sse2")
#include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#include <custom/prettyprint.hpp>
#endif
using namespace std;

typedef long long ll;
#define FOR(i,a,b) for (int i = (a); i <= (b); ++i)
#define sz(x) (int)x.size()
#define dbg(x) cerr << #x << " = " << x << '\n'

const int MOD = 1e9+7; //998244353;
const int inf = 1e9+3;
const ll INF = ll(3e18)+3;

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;

pair<int,int> segs[N];

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

    int n,m,k; cin >> n >> m >> k;
    for(int i=1; i<=m; ++i) {
        cin >> segs[i].first >> segs[i].second;
    }

    int ans = 0;
    FOR(i,1,n-k+1) {
        FOR(j,i,n-k+1) {
            int cur = 0;
            FOR(l,1,m) cur += max(0,max(min(i+k-1,segs[l].second)-max(i,segs[l].first), min(j+k-1,segs[l].second)-max(j,segs[l].first))+1);
            ans = max(ans, cur);
        }
    }
    cout << ans << '\n';

}