#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll INF=1000000099;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define fs first
#define sc second
vector<int> dx={0,0,-1,1};
vector<int> dy={-1,1,0,0};

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
   int g,r,n;cin>>r>>g>>n;
   vector<vector<int>> v(g,vector<int>(r,-INF));
   map<pair<int,int>,int> ma;

   rep(i,0,n){
      int x,y,c;cin>>x>>y>>c;
      x--;y--;
      ma[{y,x}]=c;
   }
   
   for(auto itr=ma.begin();itr!=ma.end();itr++){
      vector<vector<bool>> used(g,vector<bool>(r,false));
      queue<int> q;
      q.push((*itr).fs.fs);
      q.push((*itr).fs.sc);
      q.push((*itr).sc); 
      used[(*itr).fs.fs][(*itr).fs.sc]=true;

      while(!q.empty()){
         int nowg,nowr,sco;
         nowg=q.front();q.pop();
         nowr=q.front();q.pop();
         sco=q.front();q.pop();
         if(ma.count({nowg,nowr}) && ma[{nowg,nowr}]<sco){
            cout<<"No"<<endl;
            return 0;
         }
         v[nowg][nowr]=max(v[nowg][nowr],sco);
         sco--;
         rep(i,0,4){
            int nextg=nowg+dx[i];
            int nextr=nowr+dy[i];
            //cerr<<nextg<<" "<<nextr<<endl;
            if(nextg<0 || nextr<0 || nextg>=g || nextr>=r || used[nextg][nextr])continue;
            q.push(nextg);
            q.push(nextr);
            q.push(sco);
            used[nextg][nextr]=true;
         }
      }
   }

   int ans=0;
   rep(i,0,g)rep(j,0,r){
      ans+=v[i][j];
   }
   cout<<ans<<endl;
}
