#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int SZ = 5555;
int n, a, b, k, dp[SZ], tmp[SZ];
inline int myabs(int x) { return x > 0 ? x : -x; }
int main() {
  while (scanf("%d%d%d%d", &n, &a, &b, &k) == 4) {
    memset(tmp, 0, sizeof(tmp));
    memset(dp, 0, sizeof(dp));
    dp[a] = 1;
    for (int iter = 1; iter <= k; ++iter) {
      memset(tmp, 0, sizeof(tmp));
      for (int fl = 1; fl <= n; ++fl) {
        int dist = myabs(fl - b);
        int lhs = fl - (dist - 1), rhs = fl + (dist - 1);
        lhs = max(lhs, 1);
        rhs = min(n, rhs);
        if (dp[fl]) {
          tmp[lhs] = (tmp[lhs] + dp[fl]) % MOD;
          tmp[rhs + 1] = (-dp[fl] + tmp[rhs + 1]) % MOD;
        }
        dp[fl] = -dp[fl];
      }
      int genval = 0;
      for (int fl = 1; fl <= n; ++fl) {
        genval += tmp[fl];
        genval %= MOD;
        dp[fl] += genval;
        dp[fl] %= MOD;
      }
    }
    int res = 0;
    for (int ind = 1; ind <= n; ++ind) {
      res += dp[ind];
      res %= MOD;
    }
    res += MOD;
    res %= MOD;
    printf("%d\n", res);
  }
}
