#include<iostream>
#include<cassert>
#include<algorithm>
#include<vector>
using namespace std;
#define H_MAX 100000
int W, H, N;
int MX[H_MAX], X[H_MAX];

int main(){
  int x, y;
  cin >> W >> H >> N;
  for ( int i = 0; i < H; i++ ) MX[i] = X[i] = -1;
  for ( int i = 0; i < N; i++){
    cin >> x >> y;
    X[y] = max(X[y], x);
  }
  MX[H-1] = 0;
  for ( int i = H-2; i >= 0; i-- ){
    MX[i] = max(MX[i+1], X[i+1]);
  }

  int ans = H;
  for ( int i = 0; i < H; i++ ){
    ans = min(ans, i + MX[i]);
  }

  cout << ans << endl;

  return 0;
}


