#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353, inv2 = 499122177;
int add(int a, int b, int p = mod) { return a + b >= p ? a + b - p : a + b; }
int sub(int a, int b, int p = mod) { return a - b < 0 ? a - b + p : a - b; }
int mul(int a, int b, int p = mod) { return (long long)a * b % p; }
void sadd(int &a, int b, int p = mod) { a = add(a, b, p); }
void ssub(int &a, int b, int p = mod) { a = sub(a, b, p); }
void smul(int &a, int b, int p = mod) { a = mul(a, b, p); }
int Power(int a, int k, int p = mod) {
  int res = 1;
  for (; k; k >>= 1, smul(a, a, p))
    if (k & 1) smul(res, a, p);
  return res;
}
int Get_inv(int a, int p = mod) { return Power(a, p - 2, p); }
int Power(int a, long long k, int p = mod) {
  int res = 1;
  for (; k; k >>= 1, smul(a, a, p))
    if (k & 1) smul(res, a, p);
  return res;
}
int n, m, l, r;
int main() {
  scanf("%d%d%d%d", &n, &m, &l, &r);
  r -= l - 1;
  int a = r >> 1, b = r - a;
  r %= mod;
  long long k = (long long)n * m;
  if (n & 1 && m & 1) {
    printf("%d\n", Power(r, k));
    return 0;
  }
  printf("%d\n", mul(add(Power(r, k), Power(sub(a, b), k)), inv2));
  return 0;
}
