#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int dx[] = {-1, 1, 0, 0};
const int dy[] = {0, 0, 1, -1};
const long long MOD = 1000000007LL;
int n, a, b, k;
long long dp[2][5010];
long long imo[5010];
long long ret;
inline long long md(long long x) {
  if (x >= MOD) x -= MOD;
  return x;
}
int main() {
  cin >> n >> a >> b >> k;
  dp[0][a] = 1;
  int f = 1, p = 0;
  for (int i = (0); i < (k); ++i) {
    memset(imo, 0, sizeof(imo));
    for (int x = 1; x <= n; ++x) {
      int d = abs(x - b);
      if (d == 1) continue;
      if (x > 1) {
        int l = max(1, x - d + 1);
        imo[l] = md(imo[l] + dp[p][x]);
        imo[x] = md(imo[x] - dp[p][x] + MOD);
      }
      if (x + 1 <= n) {
        imo[x + 1] = md(imo[x + 1] + dp[p][x]);
        int r = min(n, x + d - 1);
        imo[r + 1] = md(imo[r + 1] - dp[p][x] + MOD);
      }
    }
    long long s = 0;
    for (int j = 1; j <= n; ++j) {
      s = md(s + imo[j]);
      if (j != b)
        dp[f][j] = s;
      else
        dp[f][j] = 0;
    }
    swap(f, p);
  }
  for (int i = 1; i <= n; ++i) {
    ret = md(ret + dp[k & 1][i]);
  }
  cout << ret << endl;
  return 0;
}
