#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stdio.h>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <math.h>
#include <iomanip>
using namespace std;
#define Would
#define you
const int INF = 999999999;
const int MOD = 1e9 + 7;
const double pi = 3.141592653589793238;

int a, b, c, mon[100005], ans = INF;
int main() {
	cin >> a >> b >> c;
	for (int i = 0; i < c; ++i) {
		int n, m;
		cin >> n >> m;
		mon[n] = max(mon[n], m);
	}
	for (int i = 0; i < a; ++i) { mon[a - i - 1] = max(mon[a - i - 1], mon[a - i]); }
	for (int i = 0; i < a; ++i) { ans = min(ans, mon[i + 1] + i); }
	cout << ans << endl;
}

