#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
#define maxn 2005
struct node {
	int l, r;
}p[maxn];
int n, m, k, ans;
int sum[maxn];

bool cmp( node x, node y ) {
	return x.l + x.r < y.l + y.r;
}

int main() {
	scanf( "%d %d %d", &n, &m, &k );
	for( int i = 1;i <= m;i ++ )
		scanf( "%d %d", &p[i].l, &p[i].r ), p[i].l --;
	sort( p + 1, p + m + 1, cmp );
	for( int i = 0;i <= n - k;i ++ ) {
		int tmp = 0;
		for( int j = m;j;j -- ) {
			tmp += max( 0, min( i + k, p[j].r ) - max( i, p[j].l ) );
			sum[j] = max( sum[j], tmp );
		}
	}
	for( int i = 0;i <= n - k;i ++ ) {
		int tmp = 0;
		for( int j = 0;j <= m;j ++ ) {
			tmp += max( 0, min( i + k, p[j].r ) - max( i, p[j].l ) );
			ans = max( ans, tmp + sum[j + 1] );
		}
	}
	printf( "%d\n", ans );
	return 0;
}