#include <bits/stdc++.h>

using namespace std;

const int INF = 1 << 30;

int main()
{
  int W, H, N, L[100000] = {};

  scanf("%d %d %d", &W, &H, &N);
  for(int i = 0; i < N; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    L[x] = max(L[x], y);
  }

  int ret = INF, curr = 0;
  for(int i = W - 1; i >= 0; i--) {
    ret = min(ret, i + curr);
    curr = max(curr, L[i]);
  }

  cout << ret << endl;
}