#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

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

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100


int main(){
  int W, H, N;
  int ans[SIZE][SIZE];
  int x[SIZE], y[SIZE], z[SIZE];

  cin >> W >> H >> N;

  priority_queue<pair<int, pair<int,int>>> pq;

  for (int i=0; i<H; i++) {
    for (int j=0; j<W; j++) {
      ans[i][j] = -INF;
    }
  }


  for (int i=0; i<N; i++) {
    cin >> x[i] >> y[i] >> z[i];
    x[i]--; y[i]--;
    pq.push({z[i], {y[i], x[i]}});
  }

  while(pq.size()) {
    auto p = pq.top(); pq.pop();
    int y = p.second.first;
    int x = p.second.second;
    int z = p.first;

    if (ans[y][x] != -INF) continue;
    ans[y][x] = z;

    if (0 < y) pq.push({z-1, {y-1, x}});
    if (0 < x) pq.push({z-1, {y, x-1}});
    if (y < H-1) pq.push({z-1, {y+1, x}});
    if (x < W-1) pq.push({z-1, {y, x+1}});
  }

  for (int i=0; i<N; i++) {
    ans[y[i]][x[i]] = z[i];
  }

  int sum = 0;

  bool ng = false;

  for (int i=0; i<H; i++) {
    for (int j=0; j<W; j++) {
      if (0 < i) ng |= abs(ans[i][j] - ans[i-1][j]) > 1;
      if (0 < j) ng |= abs(ans[i][j] - ans[i][j-1]) > 1;
      if (i < H-1) ng |= abs(ans[i][j] - ans[i+1][j]) > 1;
      if (j < W-1) ng |= abs(ans[i][j] - ans[i][j+1]) > 1;
    }
  }

  if (ng) {
    puts("No");
    return 0;
  }

  for (int i=0; i<H; i++) {
    for (int j=0; j<W; j++) {
      sum += ans[i][j];
    }
  }

  cout << sum << endl;

  return 0;
}

