#include <cstdio>
#include <cmath>
#include <algorithm>
#include <queue>
#include <vector>
#include <cstring>
#define MAXN 200005
#define MAXM
#define LL long long
#define LD long double
using namespace std;

int h, w, n, d;

struct A {int x, y;} a[MAXN];

bool CMP(A c, A d)
{
	if(c.x==d.x) return c.y<d.y;
	return c.x<d.x;
}

int main()
{
	scanf("%d%d%d", &h, &w, &n);
	for(int i=1; i<=n; i++) scanf("%d%d", &a[i].x, &a[i].y);
	sort(a+1, a+n+1, CMP);
	for(int i=1; i<=n; i++)
	{
		if(a[i].x-a[i].y>=d+1)
		{
			printf("%d\n", a[i].x-1);
			return 0;
		}
		if(a[i].x-a[i].y==d) d++;
	}
	printf("%d\n", h);
	return 0;
}
