#include <bits/stdc++.h>
using namespace std;
const int N = 5010;
const long long mo = 1000000007;
int n, A, B, K;
long long ans, f[2][N], g[2][N];
inline void calc(int x) {
  memset(g[x], 0, sizeof(g[x]));
  for (int i = 1; i <= B; ++i) g[x][i] = (g[x][i - 1] + f[x][i]) % mo;
}
int main() {
  scanf("%d%d%d%d", &n, &A, &B, &K);
  if (A > B) {
    A = n - A + 1;
    B = n - B + 1;
  }
  f[1][A] = 1;
  calc(1);
  for (int i = 1; i <= K; ++i) {
    int pre = i & 1, now = pre ^ 1;
    for (int j = 1; j < B; ++j)
      f[now][j] = (g[pre][(B + j - 1) / 2] - f[pre][j] + mo) % mo;
    calc(now);
    ans = g[now][B];
  }
  cout << ans << "\n";
  return 0;
}
