#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<numeric>
#include<limits>
#include<map>
using namespace std;

#define rep(i,s,n) for(int i=s;i<n;i++)
#define dow(i,n,s) for(int i=n-1;i>=s;i--)
#define all(a) a.begin(),a.end()
#define rng(a,b,e) a.begin()+a,a.begin()+e
#define Sort(a) sort(a.begin(),a.end())
#define Qsort(a,size) qsort(a,size,sizeof(*a),compare_int)
typedef pair<int,int> II;
typedef pair<double,double> DD;
typedef pair<int,string> IS;
typedef unsigned long ul;
typedef long long ll;
typedef unsigned long long ull;
bool compare_by_second(II a,II b) {
  if(a.second != b.second) return a.second < b.second;
  return a.first < b.first;
}
bool compare_int(const void *a,const void *b) { return *(int *)a - *(int *)b; }

const int INF = 1e+9;
const int MAX_R = 5e+2;
const int MAX_S = 5e+2;
const int MAX_P = 5e+5;

int r,s,p;
II goal;
bool flag;
vector<int> position;
vector<int> vtmp;

void solve();

int main() {

  cin>>r>>s>>p;
  goal.first = r+1; goal.second = s+1;
  int itmp1,itmp2;
  rep(i,0,p) {
    cin>>itmp1>>itmp2;
    if(itmp2>s) itmp2++;
    position.push_back(abs(goal.first-itmp1)+abs(goal.second-itmp2));
  }
  //rep(i,0,position.size()) cout<<position[i]<<endl;
  solve();

  return 0;
}

void solve() {
  /*
  flag = true;
  while(flag) {
    sort(all(position));
    vtmp = position;
    dow(i,position.size(),1) {
      if(position[i] == position[i-1]) vtmp[i]++;
    }
    position.clear();
    position = vtmp;
    vtmp.clear();

    rep(i,0,position.size()-1) flag &= (position[i] != position[i+1]);
    flag = !flag;

    cout<<boolalpha<<flag<<endl;
    cout<<"----position----"<<endl;
    rep(i,0,position.size()) cout<<position[i]<<endl;
  }
  */
  sort( all(position),greater<int>() );
  rep(i,0,position.size()) position[i]+=i;
  sort( all(position),greater<int>() );
  cout<<position[0]<<endl;
}

