#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
int L, R;
long long N, M;
struct Matrix {
  long long a[2][2];
  void clear() {
    for (int i = 0; i < 2; ++i)
      for (int j = 0; j < 2; ++j) a[i][j] = 0;
  }
  void init() {
    clear();
    a[0][0] = a[1][1] = 1;
  }
  void pre(int A, int B) {
    a[0][1] = a[1][0] = A;
    a[0][0] = a[1][1] = B;
  }
  void out() {
    for (int i = 0; i < 2; ++i, printf("\n"))
      for (int j = 0; j < 2; ++j) printf("%lld ", a[i][j]);
  }
} BASE, t, Ans;
Matrix mul(Matrix a, Matrix b) {
  Matrix c;
  c.clear();
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < 2; ++j) {
      for (int k = 0; k < 2; ++k) c.a[i][j] += a.a[i][k] * b.a[k][j] % MOD;
      c.a[i][j] %= MOD;
    }
  return c;
}
void Pow() {
  t = BASE;
  Ans.init();
  for (; N; N >>= 1, t = mul(t, t))
    if (N & 1) Ans = mul(Ans, t);
}
int POW(int x, long long k) {
  x %= MOD;
  int ans = 1;
  for (; k; k >>= 1, x = 1LL * x * x % MOD)
    if (k & 1) ans = 1LL * ans * x % MOD;
  return ans;
}
int main() {
  cin >> N >> M >> L >> R;
  N *= M;
  if (N & 1) {
    cout << POW(R - L + 1, N) << endl;
    return 0;
  }
  int len = R - L + 1;
  int a, b;
  a = b = len / 2;
  if (len & 1) {
    if (L & 1)
      a++;
    else
      b++;
  }
  BASE.pre(a, b);
  Pow();
  cout << Ans.a[0][0] << endl;
  return 0;
}
