#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const bool debug = true;
#define ff first
#define ss second
#define yes cout << "Yes\n"
#define no cout << "No\n"
#define YN(x) if(x)yes; else no;
#define all(X) (X).begin(), (X).end()
#define rall(X) (X).rbegin(), (X).rend()
#define blt __builtin_popcount
const int mod = 1e9 + 7;
#ifndef ONLINE_JUDGE
#define dbg(x) cerr << #x <<" "; print(x); cerr << endl;
#else
#define dbg(x)
#endif
#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#define __builtin_popcountll __popcnt64
#endif
void print(long long t) { cerr << t; }
void print(int t) { cerr << t; }
void print(string t) { cerr << t; }
void print(char t) { cerr << t; }
void print(double t) { cerr << t; }
void print(long double t) { cerr << t; }
void print(unsigned long long t) { cerr << t; }
template <class T, class V> void print(pair <T, V> p);
template <class T> void print(vector <T> v);
template <class T> void print(set <T> v);
template <class T, class V> void print(map <T, V> v);
template <class T> void print(multiset <T> v);
template <class T, class V> void print(T v[], V n) { cerr << "["; for (int i = 0; i < n; i++) { cerr << v[i] << " "; } cerr << "]"; }
template <class T, class V> void print(pair <T, V> p) { cerr << "{"; print(p.first); cerr << ","; print(p.second); cerr << "}"; }
template <class T> void print(vector <T> v) { cerr << "[ "; for (T i : v) { print(i); cerr << " "; } cerr << "]"; }
template <class T> void print(set <T> v) { cerr << "[ "; for (T i : v) { print(i); cerr << " "; } cerr << "]"; }
template <class T> void print(multiset <T> v) { cerr << "[ "; for (T i : v) { print(i); cerr << " "; } cerr << "]"; }
template <class T, class V> void print(map <T, V> v) { cerr << "[ "; for (auto i : v) { print(i); cerr << " "; } cerr << "]"; }
template <class T> void print(queue <T> q) { cerr << "[ "; while (!q.empty()) { print(q.front()); cerr << " "; q.pop(); } cerr << "]"; }
template <class T> void print(priority_queue <T> q) { cerr << "[ "; while (!q.empty()) { print(q.top()); cerr << " "; q.pop(); } cerr << "]"; }
template <class T> void print(int n__, T arr[]) { cerr << "[ "; for (int i = 0; i <= n__; i++) { print(arr[i]); cerr << " "; } cerr << "]"; }
ll gcdll(ll a, ll b) { return b == 0 ? a : gcdll(b, a % b); }
long long mult(long long a, long long b)
{
return (a * b) % mod;
}
long long binpow(long long a, long long b) {
long long res = 1;
a %= mod;
while (b > 0) {
if (b & 1) res = res * a % mod;
a = a * a % mod;
b >>= 1;
}
return res;
}
long long m_inverse(long long n) {
return binpow(n, mod - 2);
}
long long divide(long long a, long long b) {
return (a % mod * m_inverse(b)) % mod;
}
long long sub(long long a, long long b)
{
if (a - b >= 0)return a - b;
else return a - b + mod;
}
long long add(long long a, long long b)
{
if (a + b >= mod)return a + b - mod;
else return a + b;
}
const int LOG = 21;
const int N = 1e6 + 5;
const ll inf = 1e18;
ll n, m, k;
ll c[N], r[N];
ll sum_r[N], sum_c[N];
ll a(int i, int j)
{
return add(j, mult(i - 1, m));
}
void solve()
{
vector<pair<int, int>>row, col;
cin >> n >> m >> k;
ll sum_all = 0;
sum_r[1] = divide(mult(m, m + 1), 2);
sum_c[1] = add(n, mult(m, divide(mult(n, n - 1), 2)));
for (int i = 1; i <= n; i++) {
r[i] = 1;
if (i != 1)
sum_r[i] = add(sum_r[i - 1], mult(m, m));
sum_all = add(sum_all, sum_r[i]);
}
for (int i = 1; i <= m; i++) {
c[i] = 1;
if (i != 1)
sum_c[i] = add(sum_c[i - 1], n);
}
set<int>st_R, st_C;
for (int i = 1; i <= k; i++)
{
char ch;
int x;
ll y;
cin >> ch >> x >> y;
if (ch == 'R')
{
r[x] = mult(r[x], y);
st_R.insert(x);
}
else {
c[x] = mult(c[x], y);
st_C.insert(x);
}
}
ll ans = 0;
for (int i = 1; i <= n; i++)
{
ans = add(ans, mult(r[i], sum_r[i]));
}
for (int i = 1; i <= m; i++)
{
ans = add(ans, mult(c[i], sum_c[i]));
}
for (auto i : st_R)
{
for (auto j : st_C)
{
ll A = a(i, j);
ans = sub(ans, mult(A, add(r[i], c[j])));
ans = add(ans, mult(A, mult(r[i], c[i])));
ans = add(ans, A);
}
}
cout << sub(ans, sum_all) << endl;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int t = 1;
//cin >> t;
while (t--)
{
solve();
}
return 0;
}