using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        new Program().Solve();
    }

    Scanner sc = new Scanner();
    void Solve()
    {
        int w = sc.NextInt();
        int h = sc.NextInt();
        int n = sc.NextInt();
        int maxX = w;
        int minX = 0;
        int maxY = h;
        int minY = 0;
        for (int i = 0; i < n; i++)
        {
            int x = sc.NextInt();
            int y = sc.NextInt();
            int a = sc.NextInt();
            if (a == 1)
            {
                if (minX < x) minX = x;
            }
            if (a == 2)
            {
                if (maxX > x) maxX = x;
            }
            if (a == 3)
            {
                if (minY < y) minY = y;
            }
            if (a == 4)
            {
                if (maxY > y) maxY = y;
            }
        }
        int ans = (maxX - minX) * (maxY - minY);
        if (ans < 0) wl(0);
        else wl(ans);
        rk();
    }
    // ------------------------------------- //
    void wl(string v) { Console.WriteLine(v); }
    void wl(int v) { Console.WriteLine(v); }
    void rk() { Console.ReadKey(); }
    int calcDivisorCount(int n)
    {
        if (n == 1) return n;

        int res = 0;
        int i = 2;
        while (n != 1)
        {
            int cnt = 0;
            while (n % i == 0)
            {
                n /= i;
                cnt++;
            }
            if (cnt > 0) res += (cnt + 1);
            i++;
        }
        return res;
    }
    long gcd(long a, long b) { return b == 0 ? a : gcd(b, a % b); }
    long lcm(long a, long b) { return a / gcd(a, b) * b; }
}
class Scanner
{
    public Scanner() { }
    private string[] buff = null;
    private int bIndex = 0;
    public string Next()
    {
        if (buff == null || bIndex >= buff.Length)
        {
            buff = Console.ReadLine().Split(' ');
            bIndex = 0;
        }
        return buff[bIndex++];
    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
}
class Pair<T, K>
{
    public Pair() { }
    public Pair(T f, K s)
    {
        first = f;
        second = s;
    }
    public T first {get; set;}
    public K second {get; set;}
}
