#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
using ld = long double;
template <class T>
using Table = vector<vector<T>>;
const ld eps = 1e-9;
template <class S, class T>
ostream &operator<<(ostream &os, const pair<S, T> v) {
  os << "( " << v.first << ", " << v.second << ")";
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (int i = 0; i < v.size(); i++) {
    if (i > 0) {
      os << " ";
    }
    os << v[i];
  }
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const vector<vector<T>> &v) {
  for (int i = 0; i < v.size(); i++) {
    if (i > 0) {
      os << endl;
    }
    os << v[i];
  }
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const vector<set<T>> &v) {
  for (int i = 0; i < v.size(); i++) {
    if (i > 0) {
      os << endl;
    }
    os << v[i];
  }
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const set<T> &v) {
  int i = 0;
  for (auto it : v) {
    if (i > 0) {
      os << ' ';
    }
    os << it;
    i++;
  }
  return os;
}
using ll = long long;
const int mod = 998244353;
struct Mod {
 public:
  int num;
  Mod() : Mod(0) { ; }
  Mod(long long int n) : num((n % mod + mod) % mod) {
    static_assert(mod < INT_MAX / 2,
                  "mod is too big, please make num 'long long int' from 'int'");
  }
  Mod(int n) : Mod(static_cast<long long int>(n)) { ; }
  operator int() { return num; }
};
Mod operator+(const Mod a, const Mod b) { return Mod((a.num + b.num) % mod); }
Mod operator+(const long long int a, const Mod b) { return Mod(a) + b; }
Mod operator+(const Mod a, const long long int b) { return b + a; }
Mod operator++(Mod &a) { return a + Mod(1); }
Mod operator-(const Mod a, const Mod b) {
  return Mod((mod + a.num - b.num) % mod);
}
Mod operator-(const long long int a, const Mod b) { return Mod(a) - b; }
Mod operator--(Mod &a) { return a - Mod(1); }
Mod operator*(const Mod a, const Mod b) {
  return Mod(((long long)a.num * b.num) % mod);
}
Mod operator*(const long long int a, const Mod b) { return Mod(a) * b; }
Mod operator*(const Mod a, const long long int b) { return Mod(b) * a; }
Mod operator*(const Mod a, const int b) { return Mod(b) * a; }
Mod operator+=(Mod &a, const Mod b) { return a = a + b; }
Mod operator+=(long long int &a, const Mod b) { return a = a + b; }
Mod operator-=(Mod &a, const Mod b) { return a = a - b; }
Mod operator-=(long long int &a, const Mod b) { return a = a - b; }
Mod operator*=(Mod &a, const Mod b) { return a = a * b; }
Mod operator*=(long long int &a, const Mod b) { return a = a * b; }
Mod operator*=(Mod &a, const long long int &b) { return a = a * b; }
Mod operator^(const Mod a, const int n) {
  if (n == 0) return Mod(1);
  Mod res = (a * a) ^ (n / 2);
  if (n % 2) res = res * a;
  return res;
}
Mod mod_pow(const Mod a, const int n) {
  if (n == 0) return Mod(1);
  Mod res = mod_pow((a * a), (n / 2));
  if (n % 2) res = res * a;
  return res;
}
Mod inv(const Mod a) { return a ^ (mod - 2); }
Mod operator/(const Mod a, const Mod b) {
  assert(b.num != 0);
  return a * inv(b);
}
Mod operator/(const long long int a, const Mod b) { return Mod(a) / b; }
Mod operator/=(Mod &a, const Mod b) { return a = a / b; }
Mod fact[102400], factinv[102400];
void init(const int amax = 102400) {
  fact[0] = Mod(1);
  factinv[0] = 1;
  for (int i = 0; i < amax - 1; ++i) {
    fact[i + 1] = fact[i] * Mod(i + 1);
    factinv[i + 1] = factinv[i] / Mod(i + 1);
  }
}
Mod comb(const int a, const int b) {
  return fact[a] * factinv[b] * factinv[a - b];
}
vector<Mod> get_dp(const vector<int> x_connects) {
  int x_sum = accumulate(x_connects.begin(), x_connects.end(), 0);
  vector<vector<Mod>> x_dp(x_connects.size() + 1, vector<Mod>(x_sum + 1));
  x_dp[0][0] = 1;
  for (int i = 0; i < x_connects.size(); ++i) {
    for (int now = 0; now <= x_sum; ++now) {
      for (int use = 0; use <= x_connects[i] / 2; ++use) {
        if (now + use > x_sum)
          continue;
        else {
          x_dp[i + 1][now + use] +=
              x_dp[i][now] * comb(x_connects[i] - use, use);
        }
      }
    }
  }
  return x_dp[x_connects.size()];
}
int main() {
  ios::sync_with_stdio(false);
  init();
  int H, W;
  cin >> H >> W;
  int Q;
  cin >> Q;
  vector<int> xs(W, true), ys(H, true);
  for (int i = 0; i < Q; ++i) {
    int u, l, d, r;
    cin >> u >> l >> d >> r;
    u--;
    l--;
    for (int y = u; y < d; ++y) {
      ys[y] = false;
    }
    for (int x = l; x < r; ++x) {
      xs[x] = false;
    }
  }
  vector<int> y_connects, x_connects;
  int num = 0;
  for (int y = 0; y < H; ++y) {
    if (ys[y])
      num++;
    else {
      if (num) y_connects.push_back(num);
      num = 0;
    }
  }
  if (num) y_connects.push_back(num);
  num = 0;
  for (int x = 0; x < W; ++x) {
    if (xs[x])
      num++;
    else {
      if (num) x_connects.push_back(num);
      num = 0;
    }
  }
  x_connects.push_back(num);
  num = 0;
  int x_sum = accumulate(x_connects.begin(), x_connects.end(), 0);
  int y_sum = accumulate(y_connects.begin(), y_connects.end(), 0);
  vector<Mod> x_dp = get_dp(x_connects);
  vector<Mod> y_dp = get_dp(y_connects);
  Mod ans = 0;
  for (int y2 = 0; y2 <= H / 2; ++y2) {
    for (int x2 = 0; x2 <= W / 2; ++x2) {
      if (y2 * 2 + x2 > y_sum) continue;
      if (x2 * 2 + y2 > x_sum) continue;
      Mod answer = 1;
      { answer *= x_dp[x2] * y_dp[y2]; }
      answer *= comb(x_sum - x2 * 2, y2);
      answer *= comb(y_sum - y2 * 2, x2);
      answer *= fact[y2];
      answer *= fact[x2];
      ans += answer;
    }
  }
  cout << ans.num << endl;
  return 0;
}

### Prompt

Create a solution in Cpp for the following problem:

Consider a square grid with h rows and w columns with some dominoes on it. Each domino covers exactly two cells of the grid that share a common side. Every cell is covered by at most one domino.

Let's call a placement of dominoes on the grid perfectly balanced if no row and no column contains a pair of cells covered by two different dominoes. In other words, every row and column may contain no covered cells, one covered cell, or two covered cells that belong to the same domino.

You are given a perfectly balanced placement of dominoes on a grid. Find the number of ways to place zero or more extra dominoes on this grid to keep the placement perfectly balanced. Output this number modulo 998 244 353.

Input

The first line contains three integers h, w, and n (1 ≤ h, w ≤ 3600; 0 ≤ n ≤ 2400), denoting the dimensions of the grid and the number of already placed dominoes. The rows are numbered from 1 to h, and the columns are numbered from 1 to w.

Each of the next n lines contains four integers r_{i, 1}, c_{i, 1}, r_{i, 2}, c_{i, 2} (1 ≤ r_{i, 1} ≤ r_{i, 2} ≤ h; 1 ≤ c_{i, 1} ≤ c_{i, 2} ≤ w), denoting the row id and the column id of the cells covered by the i-th domino. Cells (r_{i, 1}, c_{i, 1}) and (r_{i, 2}, c_{i, 2}) are distinct and share a common side.

The given domino placement is perfectly balanced.

Output

Output the number of ways to place zero or more extra dominoes on the grid to keep the placement perfectly balanced, modulo 998 244 353.

Examples

Input


5 7 2
3 1 3 2
4 4 4 5


Output


8


Input


5 4 2
1 2 2 2
4 3 4 4


Output


1


Input


23 42 0


Output


102848351

Note

In the first example, the initial grid looks like this:

<image>

Here are 8 ways to place zero or more extra dominoes to keep the placement perfectly balanced:

<image>

In the second example, the initial grid looks like this:

<image>

No extra dominoes can be placed here.

### Response

```cpp
#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
using ld = long double;
template <class T>
using Table = vector<vector<T>>;
const ld eps = 1e-9;
template <class S, class T>
ostream &operator<<(ostream &os, const pair<S, T> v) {
  os << "( " << v.first << ", " << v.second << ")";
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (int i = 0; i < v.size(); i++) {
    if (i > 0) {
      os << " ";
    }
    os << v[i];
  }
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const vector<vector<T>> &v) {
  for (int i = 0; i < v.size(); i++) {
    if (i > 0) {
      os << endl;
    }
    os << v[i];
  }
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const vector<set<T>> &v) {
  for (int i = 0; i < v.size(); i++) {
    if (i > 0) {
      os << endl;
    }
    os << v[i];
  }
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const set<T> &v) {
  int i = 0;
  for (auto it : v) {
    if (i > 0) {
      os << ' ';
    }
    os << it;
    i++;
  }
  return os;
}
using ll = long long;
const int mod = 998244353;
struct Mod {
 public:
  int num;
  Mod() : Mod(0) { ; }
  Mod(long long int n) : num((n % mod + mod) % mod) {
    static_assert(mod < INT_MAX / 2,
                  "mod is too big, please make num 'long long int' from 'int'");
  }
  Mod(int n) : Mod(static_cast<long long int>(n)) { ; }
  operator int() { return num; }
};
Mod operator+(const Mod a, const Mod b) { return Mod((a.num + b.num) % mod); }
Mod operator+(const long long int a, const Mod b) { return Mod(a) + b; }
Mod operator+(const Mod a, const long long int b) { return b + a; }
Mod operator++(Mod &a) { return a + Mod(1); }
Mod operator-(const Mod a, const Mod b) {
  return Mod((mod + a.num - b.num) % mod);
}
Mod operator-(const long long int a, const Mod b) { return Mod(a) - b; }
Mod operator--(Mod &a) { return a - Mod(1); }
Mod operator*(const Mod a, const Mod b) {
  return Mod(((long long)a.num * b.num) % mod);
}
Mod operator*(const long long int a, const Mod b) { return Mod(a) * b; }
Mod operator*(const Mod a, const long long int b) { return Mod(b) * a; }
Mod operator*(const Mod a, const int b) { return Mod(b) * a; }
Mod operator+=(Mod &a, const Mod b) { return a = a + b; }
Mod operator+=(long long int &a, const Mod b) { return a = a + b; }
Mod operator-=(Mod &a, const Mod b) { return a = a - b; }
Mod operator-=(long long int &a, const Mod b) { return a = a - b; }
Mod operator*=(Mod &a, const Mod b) { return a = a * b; }
Mod operator*=(long long int &a, const Mod b) { return a = a * b; }
Mod operator*=(Mod &a, const long long int &b) { return a = a * b; }
Mod operator^(const Mod a, const int n) {
  if (n == 0) return Mod(1);
  Mod res = (a * a) ^ (n / 2);
  if (n % 2) res = res * a;
  return res;
}
Mod mod_pow(const Mod a, const int n) {
  if (n == 0) return Mod(1);
  Mod res = mod_pow((a * a), (n / 2));
  if (n % 2) res = res * a;
  return res;
}
Mod inv(const Mod a) { return a ^ (mod - 2); }
Mod operator/(const Mod a, const Mod b) {
  assert(b.num != 0);
  return a * inv(b);
}
Mod operator/(const long long int a, const Mod b) { return Mod(a) / b; }
Mod operator/=(Mod &a, const Mod b) { return a = a / b; }
Mod fact[102400], factinv[102400];
void init(const int amax = 102400) {
  fact[0] = Mod(1);
  factinv[0] = 1;
  for (int i = 0; i < amax - 1; ++i) {
    fact[i + 1] = fact[i] * Mod(i + 1);
    factinv[i + 1] = factinv[i] / Mod(i + 1);
  }
}
Mod comb(const int a, const int b) {
  return fact[a] * factinv[b] * factinv[a - b];
}
vector<Mod> get_dp(const vector<int> x_connects) {
  int x_sum = accumulate(x_connects.begin(), x_connects.end(), 0);
  vector<vector<Mod>> x_dp(x_connects.size() + 1, vector<Mod>(x_sum + 1));
  x_dp[0][0] = 1;
  for (int i = 0; i < x_connects.size(); ++i) {
    for (int now = 0; now <= x_sum; ++now) {
      for (int use = 0; use <= x_connects[i] / 2; ++use) {
        if (now + use > x_sum)
          continue;
        else {
          x_dp[i + 1][now + use] +=
              x_dp[i][now] * comb(x_connects[i] - use, use);
        }
      }
    }
  }
  return x_dp[x_connects.size()];
}
int main() {
  ios::sync_with_stdio(false);
  init();
  int H, W;
  cin >> H >> W;
  int Q;
  cin >> Q;
  vector<int> xs(W, true), ys(H, true);
  for (int i = 0; i < Q; ++i) {
    int u, l, d, r;
    cin >> u >> l >> d >> r;
    u--;
    l--;
    for (int y = u; y < d; ++y) {
      ys[y] = false;
    }
    for (int x = l; x < r; ++x) {
      xs[x] = false;
    }
  }
  vector<int> y_connects, x_connects;
  int num = 0;
  for (int y = 0; y < H; ++y) {
    if (ys[y])
      num++;
    else {
      if (num) y_connects.push_back(num);
      num = 0;
    }
  }
  if (num) y_connects.push_back(num);
  num = 0;
  for (int x = 0; x < W; ++x) {
    if (xs[x])
      num++;
    else {
      if (num) x_connects.push_back(num);
      num = 0;
    }
  }
  x_connects.push_back(num);
  num = 0;
  int x_sum = accumulate(x_connects.begin(), x_connects.end(), 0);
  int y_sum = accumulate(y_connects.begin(), y_connects.end(), 0);
  vector<Mod> x_dp = get_dp(x_connects);
  vector<Mod> y_dp = get_dp(y_connects);
  Mod ans = 0;
  for (int y2 = 0; y2 <= H / 2; ++y2) {
    for (int x2 = 0; x2 <= W / 2; ++x2) {
      if (y2 * 2 + x2 > y_sum) continue;
      if (x2 * 2 + y2 > x_sum) continue;
      Mod answer = 1;
      { answer *= x_dp[x2] * y_dp[y2]; }
      answer *= comb(x_sum - x2 * 2, y2);
      answer *= comb(y_sum - y2 * 2, x2);
      answer *= fact[y2];
      answer *= fact[x2];
      ans += answer;
    }
  }
  cout << ans.num << endl;
  return 0;
}

```