#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define dep(i, a, n) for(int i = a; i >= (n); i--)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

ll w, h, n, s[100001], result = INF;

signed main() {
  rep(i, 100001) s[i] = 0;
	cin >> w >> h >> n;
  rep(i, n) {
    ll x, y;
    cin >> x >> y;
    s[y] = max(s[y], x);
  }
  dep(i, h - 2, 0) s[i] = max(s[i], s[i + 1]);
  rep(i, h) result = min(result, s[i + 1] + i);
  cout << result << endl;
	return 0;
}
