#include<cstdio>
#include<queue>
#include<set>
#include<cmath>
using namespace std;
typedef long long ll;
struct node {
int x, y, r;
}s[102];
struct hhh {
int col, id;
bool f;
bool operator < (const hhh &t) const {
if(col == t.col)//C
return id < t.id;
return col > t.col;
}
};
priority_queue <hhh> q;
set <int, greater <int> > st;//A
int n, m, k;
ll ans;
int main() {
int tmp, tt;
scanf("%d %d %d", &n, &m, &k);
for(int i = 1; i <= k; i ++) {
scanf("%d %d %d", &s[i].x, &s[i].y, &s[i].r);
}
for(int i = 1; i <= n; i ++) {
for(int j = 1; j <= k; j ++) {
if(s[j].x + s[j].r < i || s[j].x - s[j].r > i)
continue;
tt = (int) sqrt(1ll * s[j].r * s[j].r - 1ll * (i - s[j].x) * (i - s[j].x));
q.push((hhh) {s[j].y - tt, j, 1});
q.push((hhh) {s[j].y + tt + 1, j, 0});
}
tmp = 1;
while(! q.empty()) {
hhh t = q.top();
q.pop();
if(t.f == 1) {
if(st.empty()) {
ans += 1ll * (t.col - tmp) * k;
tmp = t.col;
}
else if(t.id > * st.begin()) {
ans += 1ll * (t.col - tmp) * (k - * st.begin());
tmp = t.col;
}
st.insert(t.id);
}
else {
if(* st.begin() == t.id) {
ans += 1ll * (t.col - tmp) * (k - t.id);
tmp = t.col;
}
st.erase(t.id);
}
}
ans += 1ll * (m - tmp + 1) * k;//B
}
printf("%lld\n", ans);
return 0;
}