#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, l, r, k, t, d = 0, p = 1, i, c = 0, mod = 998244353;
  scanf("%lld %lld %lld %lld", &n, &m, &l, &r);
  k = n * m;
  m = k;
  t = (r - l + 1);
  for (; k; k = k >> 1) {
    if (k & 1) p = (p * t) % (mod * 2);
    t = (t * t) % (mod * 2);
  }
  if (m % 2 == 1)
    printf("%lld", (p % mod));
  else
    printf("%lld", ((p + 1) / 2) % mod);
}
