#include<bits/stdc++.h>
using namespace std;

#define rep(i, a, n) for(int i=(a); i<(n); ++i)
#define per(i, a, n) for(int i=(a); i>(n); --i)
#define pb emplace_back
#define mp make_pair
#define clr(a, b) memset(a, b, sizeof(a))
#define all(x) (x).begin(),(x).end()
#define lowbit(x) (x & -x)
#define fi first
#define se second
#define lson o<<1
#define rson o<<1|1
#define gmid l[o]+r[o]>>1
 
using LL = long long;
using ULL = unsigned long long;
using pii = pair<int,int>;
using PLL = pair<LL, LL>;
using UI = unsigned int;
 
const int mod = 998244353;
const int inf = 0x3f3f3f3f;
const double EPS = 1e-8;
const double PI = acos(-1.0);

LL a, b, c;

LL cal(LL x){
	x = (x + 1) * x / 2;
	return x % mod;
}

int main(){
	scanf("%lld %lld %lld", &a, &b, &c);
	printf("%lld\n", cal(a) * cal(b) % mod * cal(c) % mod);
	return 0;
}

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<stdio.h>
#include<algorithm>
constexpr long long MOD = 998244353;
constexpr long long MOD32 = 665496236;

int main(){
    long H=0, W=0, K=0;
    char c=getchar_unlocked();
    while(c<='9'&&c>='0') {H=(H<<1)+(H<<3)+c-'0'; c=getchar_unlocked();}
    c=getchar_unlocked();
    while(c<='9'&&c>='0') {W=(W<<1)+(W<<3)+c-'0'; c=getchar_unlocked();}
    c=getchar_unlocked();
    while(c<='9'&&c>='0') {K=(K<<1)+(K<<3)+c-'0'; c=getchar_unlocked();}
    char f[H][W];
    std::fill(f[0], f[H], 0);

    long long y = H * W - K;
    while(--K>=0){
        long h=0, w=0;
        c=getchar_unlocked();
        while(c<='9'&&c>='0') {h=(h<<1)+(h<<3)+c-'0'; c=getchar_unlocked();}
        c=getchar_unlocked();
        while(c<='9'&&c>='0') {w=(w<<1)+(w<<3)+c-'0'; c=getchar_unlocked();}
        f[h-1][w-1] = getchar_unlocked();
        getchar_unlocked();
    }
    --H; --W;
    long long dp[W+1] = {0};
    dp[0] = 1;
    for(int i = 0; i < H; ++i){
        for (int j = 0; j < W; ++j){
            switch(f[i][j]) {
                case 'R':
                    dp[j + 1] += dp[j];
                    dp[j] = 0;
                    break;
                case '\0':
                    dp[j] = dp[j] * MOD32 % MOD;
                case 'X':
                    dp[j + 1] += dp[j];
            }
        }
            switch(f[i][W]) {
                case 'R':
                    dp[W] = 0;
                    break;
                case '\0':
                    dp[W] = dp[W] * MOD32 % MOD;
            }
    }
    for (int j = 0; j < W; ++j){
        switch(f[H][j]) {
            case '\0':
                dp[j] = dp[j] * MOD32 % MOD;
            case 'R':
            case 'X':
                dp[j + 1] += dp[j];
        }
    }

    long long ans = dp[W] % MOD;
    long long x = 3;
    while(y) {
      if(y & 1) ans = ans * x % MOD;
      x = x * x % MOD;
      y >>= 1;
    }
    printf("%d", ans);

    return 0;
}

