#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 10, maxm = 1e5 + 5;
const int inf = 0x7f7f7f7f, mod = 998244353;
long long n, m, l, r;
long long x, y, ans;
long long qpow(long long base, long long n, long long mod) {
  base %= mod;
  long long res = 1;
  while (n) {
    if (n & 1) res = res * base % mod;
    base = base * base % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  cin >> n >> m >> l >> r;
  long long sum = r - l + 1;
  if ((l & 1) && (r & 1))
    x = (sum + 1) / 2, y = sum - x;
  else
    x = sum / 2, y = sum - x;
  long long t = n * m;
  if (t & 1)
    ans = qpow(sum, t, mod);
  else {
    ans = (qpow((x + y), t, mod) + qpow((x - y), t, mod)) % mod;
    ans = ans * qpow(2, mod - 2, mod) % mod;
  }
  cout << ans << "\n";
  return 0;
}
