#include <bits/stdc++.h>

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const ld eps = 1e-9;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

struct Height {
  int x, y, z;
};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int w, d, n; cin >> w >> d >> n;
  vector<vector<int>> grid(w, vector<int>(d, -INF));

  vector<Height> v(n);
  for(int i=0;i<n;++i) {
    cin >> v[i].x >> v[i].y >> v[i].z;
    v[i].x--;
    v[i].y--;
  }

  bool ok = true;
  for(int i=0;i<n;++i) {
    for(int j=i+1;j<n;++j) {
      ok &= abs(v[i].z - v[j].z) <= abs(v[i].x - v[j].x) + abs(v[i].y - v[j].y);
    }
  }
  if(!ok) {
    cout << "No" << endl;
    return 0;
  }

  for(int i=0;i<n;++i) {
    for(int j=0;j<w;++j) {
      for(int k=0;k<d;++k) {
        grid[j][k] = max(grid[j][k], v[i].z - abs(v[i].x - j) - abs(v[i].y - k));
      }
    }
  }

  ll su = 0;
  for(int i=0;i<w;++i) {
    for(int j=0;j<d;++j) {
      su += grid[i][j];
    }
  }
  cout << su << endl;
}
