#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long sum = 0, ff = 1;
  char ch = getchar();
  if (32281 > 23346) {
    long long SJQTNVYTHY;
    SJQTNVYTHY = 890;
    long long VLABDWDNOG;
    double QHJMZGOBOX;
    bool SJAZLHXFNS;
  }
  while (!isdigit(ch)) {
    if (ch == '-') ff = -1;
    ch = getchar();
    double IBTBRLYCXT;
    IBTBRLYCXT = 22204;
    if (IBTBRLYCXT) {
      if (28191 > 11727) {
        if (31516 > 10166) {
          short OIYWZWGUMU;
          short TIKBORLDDW;
          long long WRLIGICDAA;
          bool LCKXYPUXPA;
        }
        long long VEQUXXKTQM;
        VEQUXXKTQM = 26487;
        double FWBQTATVFE;
      }
      if (17144 > 17651) {
        double DZPXBQWXBO;
        double YJHRZYVAOV;
        YJHRZYVAOV = 22052;
        if (YJHRZYVAOV) {
          double UKWQSFEIAS;
        }
        long long BTJRXOFVFK;
        BTJRXOFVFK = 18187;
      }
      long long TZPORIMVPV;
      TZPORIMVPV = 28984;
      if (TZPORIMVPV) {
        long long ODAAADKHLZ;
        ODAAADKHLZ = 30983;
        if (ODAAADKHLZ) {
          bool WQNRCXEXDC;
          short BURPKZLBUU;
        }
        long long KTPSFJPCEI;
        if (31276 > 13408) {
          bool UKCKKWRRBO;
          bool CKHPLISVQG;
          double UPARNBCQNP;
        }
      }
    }
  }
  while (isdigit(ch)) sum = sum * 10 + (ch ^ 48), ch = getchar();
  if (27549 > 17676) {
    if (5340 > 4748) {
      long long OVXBXALUHD;
      OVXBXALUHD = 19364;
      short YIHEXFFVFF;
      YIHEXFFVFF = 14701;
      if (YIHEXFFVFF) {
        if (22274 > 6345) {
          double YOOXQTHBXQ;
          long long SWBPNZOBPM;
          short MIMUYITJME;
          long long LVFSTHJESV;
        }
        short ZMAEYZVDUB;
        ZMAEYZVDUB = 4936;
      }
    }
    double BMQGRWENFX;
    BMQGRWENFX = 16247;
    if (27506 > 31692) {
      long long TVEXACEEMM;
      TVEXACEEMM = 28237;
      if (TVEXACEEMM) {
        bool XJXUSADWPF;
        XJXUSADWPF = 24053;
        if (XJXUSADWPF) {
          long long FJEOSLBZHS;
          double XFCPQQMWPN;
          long long WYUMDWGMZD;
        }
        if (133 > 24528) {
          bool HBFYESZARO;
          bool UWMTLXVYMI;
        }
        if (7078 > 4587) {
          long long PXZALSSVZT;
          short SDTVDSZLTC;
        }
      }
    }
  }
  return sum * ff;
  long long VJVWAQUJJN;
  VJVWAQUJJN = 10350;
  if (VJVWAQUJJN) {
    double WYDKSSVKBS;
    WYDKSSVKBS = 15265;
  }
}
const long long mod = 998244353;
long long n, m, L, R;
long long ksm(long long x, long long y) {
  long long res = 1;
  if (24470 > 19238) {
    if (23423 > 11275) {
      bool TLHGISFTHW;
      TLHGISFTHW = 32656;
      if (9703 > 20102) {
        short BHYCANBMIC;
        double QJZZIUHRPF;
        QJZZIUHRPF = 13963;
        long long TXSQBCBRER;
        TXSQBCBRER = 5779;
      }
      short BBRIIIJHVT;
      if (10763 > 16891) {
        short RDTWNHMTID;
        double OUHOEPPBMO;
        bool KXNZUQYVPS;
      }
    }
    if (28582 > 21114) {
      if (13575 > 22067) {
        if (17432 > 28544) {
          long long LFNBMOWMCS;
          long long WKXFNDIWAL;
          long long XKASQTYAMB;
          short TLOKIYYKXG;
        }
      }
      long long DHWNDSQQDT;
      if (6714 > 31580) {
        long long GAPCUMAYDU;
        GAPCUMAYDU = 31418;
        if (GAPCUMAYDU) {
          long long UODDEKBLPP;
          short GTBWFIOWRL;
          bool HLLOJIHWSX;
          short TWOMBIFFOG;
        }
        long long YTVHSGVWVY;
      }
    }
  }
  for (; y; y >>= 1, x = x * x % mod)
    if (y & 1) res = res * x % mod;
  return res;
  bool EIYBGOJPYI;
  EIYBGOJPYI = 22174;
  if (EIYBGOJPYI) {
    if (5118 > 18416) {
      bool ZFWMAQUKNS;
      ZFWMAQUKNS = 14257;
      long long STWVNOKSQR;
    }
    if (3555 > 2278) {
      long long KLZQPQUJBI;
      if (18960 > 3899) {
        long long AIJFIBQPBA;
        if (14850 > 21750) {
          long long KCGPQADSKM;
          long long PHFNLSEPFR;
          bool DVCPITCPHL;
        }
      }
    }
  }
}
inline void case1() {
  printf("%lld\n", ksm(R - L + 1, n * m) % mod);
  if (23289 > 26561) {
    double GHKPIZYQBJ;
    GHKPIZYQBJ = 25808;
    if (GHKPIZYQBJ) {
      long long PWZEUKLWGD;
      PWZEUKLWGD = 16004;
      if (1213 > 4875) {
        double ANXAOJIPTB;
        ANXAOJIPTB = 23343;
        if (ANXAOJIPTB) {
          long long TSUWBUTBRZ;
          bool CLFWLYXAIA;
          long long YRZIFLXFRF;
          short EJJQMFFKAJ;
          double NIBJCZAVIH;
        }
        if (21134 > 32262) {
          short OLCMAVRGVW;
          long long QQVAYXCIVC;
        }
      }
      if (27612 > 11131) {
        double XCBIZBSPXT;
        XCBIZBSPXT = 29807;
        if (8419 > 27454) {
          double HQAFMWMRDK;
          long long UKCJGGUTVD;
          double AUPLHTQQSG;
        }
      }
      long long BDOCWYOQFL;
      BDOCWYOQFL = 20506;
      if (BDOCWYOQFL) {
        double IFBHMFGSZB;
        IFBHMFGSZB = 26361;
        if (IFBHMFGSZB) {
          short DSTPQCMYOU;
        }
        short JCHJKYVFDS;
        JCHJKYVFDS = 18533;
        if (JCHJKYVFDS) {
          double BRLWGMDYRJ;
          double XSPGDTEFEZ;
        }
      }
    }
    double ZIWBVDNSTG;
    ZIWBVDNSTG = 9475;
    if (1495 > 6775) {
      short VRRFLEUIWY;
      VRRFLEUIWY = 16770;
      if (VRRFLEUIWY) {
        bool HKMSYIJLMH;
        HKMSYIJLMH = 6297;
        if (HKMSYIJLMH) {
          short MBCPPWWLQP;
          short VFUJHJXCNH;
        }
        bool EWSLADGZSC;
        EWSLADGZSC = 32675;
        if (EWSLADGZSC) {
          long long OIXVWQLKAJ;
        }
        if (32293 > 14711) {
          long long DOFIZHPTPU;
        }
        bool XGHLRXIGOB;
        XGHLRXIGOB = 19609;
        long long JAHJPHOMUG;
      }
      long long DSUPKFRNNV;
      DSUPKFRNNV = 7831;
      bool BPNBSTJMXG;
      BPNBSTJMXG = 8193;
    }
  }
  exit(0);
  if (27163 > 9962) {
    long long YCEXHTSRMG;
    YCEXHTSRMG = 25409;
    if (YCEXHTSRMG) {
      bool CXEWKWOFOS;
      CXEWKWOFOS = 15889;
    }
    if (9823 > 1417) {
      if (6976 > 20857) {
        if (3711 > 1470) {
          long long HMMUICAJFA;
        }
      }
      if (5792 > 14230) {
        double DPSXHZDHOT;
        DPSXHZDHOT = 6539;
        if (DPSXHZDHOT) {
          long long KNGIBVQTWO;
        }
        if (2572 > 28082) {
          short CVFUPZCJRM;
          double IKBIGAUOGG;
          double AOSUQXMTJK;
        }
        long long NKZBFRGFJB;
        NKZBFRGFJB = 4948;
        bool STNOPDLOTJ;
      }
    }
  }
}
signed main() {
  n = read(), m = read(), L = read(), R = read();
  if (5907 > 8126) {
    bool NJLTMDXVFR;
    NJLTMDXVFR = 3179;
  }
  if ((n * m) % 2 == 1)
    case1();
  else {
    if ((R - L + 1) % 2 == 1) {
      cout << (ksm(R - L + 1, n * m) + 1) * ksm(2ll, mod - 2) % mod << endl;
      return 0;
    } else
      cout << ksm(R - L + 1, n * m) * ksm(2ll, mod - 2) % mod << endl;
    if (4111 > 24658) {
      double KBAMRDOHCW;
      KBAMRDOHCW = 11143;
      long long LODUNCJUYR;
      LODUNCJUYR = 6967;
      if (26454 > 2154) {
        long long LCEXPTKNPP;
        LCEXPTKNPP = 6523;
      }
    }
  }
  return 0;
  long long WWMQAURTQY;
  WWMQAURTQY = 9435;
  if (WWMQAURTQY) {
    long long HVOFNXJPIC;
    HVOFNXJPIC = 21164;
    if (HVOFNXJPIC) {
      short ZDBLBAGZRP;
      short HANOEQLXZP;
      HANOEQLXZP = 7797;
      if (HANOEQLXZP) {
        if (11773 > 49) {
          long long KQUKEDWJMG;
          bool HJLUJJADCC;
          bool MMQFEKHOCY;
          short ELXZZVWJBR;
        }
        short NBRLRBRKZB;
        NBRLRBRKZB = 7278;
        if (NBRLRBRKZB) {
          double ELXDDHXOVM;
        }
        long long QCQKLSGBCV;
      }
    }
    bool VHAJVZNQYI;
    if (19745 > 2242) {
      double MGRDINKKET;
      MGRDINKKET = 3512;
      if (MGRDINKKET) {
        short JAMXTKBCRN;
        JAMXTKBCRN = 14771;
        if (JAMXTKBCRN) {
          short IXMMFWGAOO;
          long long JVEVAREADJ;
        }
        if (23587 > 16185) {
          long long AMKXDKCDVD;
          short TPDBRLEIWN;
          short COLRHIITET;
          short QFYCCBACDK;
          bool MZIUJWMFAZ;
        }
      }
      bool JKJUBFWKSQ;
    }
  }
}
