#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2")
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long double ld;
 
#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define rlp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define vld vector<ld>
#define pll pair<ll,ll> 
#define pld pair<ld,ld> 
#define vpll vector<pll>
#define vpld vector<pld>
#define all(X) X.begin(),X.end()
#define endl "\n"
#define sz(x) ((ll)((x).size()))

const ll N=1e5+5;

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	ll n,m,k;
	cin >> n >> m >> k;
	vpll v;
	lp(i,0,m)
	{
		ll a,b;
		cin >> a >> b;
		v.pb({a,b});
	}
	ll ans=0;
	lp(i,1,n-k+2)
	{
		lp(j,1,i+1)
		{
			ll cur=0;
			lp(z,0,m)
			{
				ll in1=max(min(i+k-1,v[z].ss)-max(i,v[z].ff)+1,0);
				ll in2=max(min(j+k-1,v[z].ss)-max(j,v[z].ff)+1,0);
				cur+=max(in1,in2);
			}
			ans=max(cur,ans);
		}
	}
	cout<<ans<<endl;
	return 0;
}