#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = (1e9 + 7);
ll power(ll a, ll b){
if(b == 0) return 1;
ll x = power(a, b/2);
if(b % 2 == 0) return (x * x) % mod;
return (((x * x) % mod) * a) % mod;
}
int main(){
ios_base::sync_with_stdio(false); cin.tie(NULL);
ll n, m, k; cin >> n >> m >> k;
vector<map<ll, bool>> col(2), row(2);
map<ll, bool> all_cols, all_rows;
for(ll i = 0; i < k; i++){
char c;
ll a, b; cin >> c >> a >> b;
bool t = (c == '+');
col[(a % 2) ^ t][b] = 1;
row[(b % 2) ^ t][a] = 1;
all_cols[b] = 1; all_rows[a] = 1;
}
ll ans_col = 1, ans_row = 1, col_cnt = 0, row_cnt = 0;
for(auto[c, x]: all_cols){
col_cnt++;
if(col[0][c] && col[1][c]) ans_col = 0;
}
ans_col *= power(2, m - col_cnt);
for(auto[r, x]: all_rows){
row_cnt++;
if(row[0][r] && row[1][r]) ans_row = 0;
}
ans_row *= power(2, n - row_cnt);
if(!ans_row || !ans_col) {
cout << (ans_col + ans_row) % mod;
return 0;
}
ll dec = 1;
if(k == 0){
cout << (ans_col + ans_row + mod - 2ll) % mod;
return 0;
}
ll pairity = -1;
for(auto[c, x]: all_cols){
if(pairity == -1) pairity = (col[0][c] ^ (c % 2));
if(pairity != (col[0][c] ^ (c % 2))) dec = 0;
}
cout << (ans_col + ans_row + mod - dec) % mod;
}