    //E
    #pragma comment(linker, "/stack:200000000")
    #pragma GCC optimize("Ofast")
    #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
    #include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    #define endl '\n'
    const int maxn = 2e3+10;
    int l[maxn],r[maxn];
    // struct Node{
    // 	int l,r;
    // 	Node(int l = 0,int r  )
    // }
    signed main(){
    	ios::sync_with_stdio(0);
    	cin.tie(0);
    	int n,m,k;
    	cin >> n >> m >> k;
    	for(int i = 1;i <= m;i++)cin >> l[i] >> r[i];
    	if(n == k){
			int ans = 0;
			for(int i = 1;i <= m;i++)ans += r[i] - l[i] + 1;
			cout << ans;
			return 0;
		}
    	int ans = 0;
    	for(int i = 1;i+k-1 <= n;i++){
    		for(int j = i+1;j+k-1 <= n;j++){
    			int tans = 0;
    			for(int x = 1;x <= m;x++){
    				int a1 = min(i+k-1,r[x]) - max(i,l[x]) + 1;
    				int a2 = min(j+k-1,r[x]) - max(j,l[x]) + 1;
    				if(a1 < 0)a1 = 0;if(a2 < 0)a2 = 0;
    				tans += max(a1,a2);
    			}
    			ans = max(ans,tans);
    		}
    	}
    	cout << ans;
    }