#include <bits/stdc++.h>
using namespace std;
vector<string> vec_splitter(string s) {
  for (char& c : s) c = c == ',' ? ' ' : c;
  stringstream ss;
  ss << s;
  vector<string> res;
  for (string z; ss >> z; res.push_back(z))
    ;
  return res;
}
void debug_out(vector<string> args, int idx) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, Head H, Tail... T) {
  if (idx > 0) cerr << ", ";
  stringstream ss;
  ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, T...);
}
void localTest() {}
const long long MOD = 998244353;
long long power(long long a, long long b, long long c) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = (ret * a) % c;
    a = (a * a) % c;
    b >>= 1LL;
  }
  return ret;
}
int main() {
  localTest();
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m, l, r;
  cin >> n >> m >> l >> r;
  long long tot = r - l + 1, even = r / 2 - (l - 1) / 2;
  long long odd = tot - even;
  long long ans = power(even + odd, n * m, MOD);
  ans = ans + power(even - odd + MOD, n * m, MOD);
  ans += MOD;
  ans %= MOD;
  ans = (ans * power(2LL, MOD - 2, MOD)) % MOD;
  if ((n * m) % 2 == 1) ans = power(tot, n * m, MOD);
  cout << ans << "\n";
  return 0;
}
