#include <bits/stdc++.h>

using namespace std;

#define int long long
#define INF 1e9
#define LINF 1e18

const int MOD = 1e9 + 7;
const int dy[]={0, 0, 1, -1};
const int dx[]={1, -1, 0, 0};

typedef pair<int, int> P;
typedef pair<P, int> Pi;
typedef pair<P, P> PP;

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

int W, H, N;
int maxX[100000], maxY[100000];
int under[100000];

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> W >> H >> N;
    int res = W;
    for(int i = 0; i < N; ++i) {
        int x, y;
        cin >> x >> y;
        chmax(maxY[x], y);
    }
    for(int i = W - 2; i >= 0; --i) {
        under[i] = max(under[i + 1], maxY[i + 1]);
    }
    for(int i = 0; i < W; ++i) {
        chmin(res, i + under[i]);
    }
    cout << res << endl;
    return 0;
}
