#include<bits/stdc++.h>
using namespace std;
#define mk make_pair
#define pb push_back

int W, H, N;
pair<int, int> C[100100];
int ma[100100];

signed main()
{
    cin >> W >> H >> N;
    for(int i = 0; i < N; i++){
        int a, b;
        cin >> a >> b;
        C[i] = mk(a, b);
    }
    for(int i = 0; i < N; i++){
        ma[C[i].first] = max(ma[C[i].first], C[i].second);
    }
    for(int i = W - 1; i >= 0; i--){
        ma[i] = max(ma[i], ma[i + 1]);
    }
    int ans = 1000000009;
    for(int i = 0; i < W; i++){
        ans = min(ans, i + ma[i + 1]);
    }
    cout << ans << endl;

    return 0;
}


