#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int dp[5005][5005];
void add(int floor, int l, int r, int d) {
  dp[floor][l] = (dp[floor][l] + d) % mod;
  dp[floor][r] = (dp[floor][r] - d + mod) % mod;
}
int main() {
  int n, a, b, k;
  while (~scanf("%d", &n)) {
    scanf("%d%d%d", &a, &b, &k);
    dp[0][a] = 1;
    int i = 0, count = 0;
    while (i < k) {
      for (int j = 1; j <= n; j++) {
        if (j == b)
          continue;
        else {
          int x = abs(j - b) - 1;
          add(i + 1, max(j - x, 1), j, dp[i][j]);
          add(i + 1, j + 1, min(j + x + 1, n + 1), dp[i][j]);
        }
      }
      int move = 0;
      for (int j = 1; j <= n; j++) {
        move = (move + dp[i + 1][j]) % mod;
        dp[i + 1][j] = move;
      }
      i++;
    }
    for (int i = 0; i < n; i++) count = (count + dp[k][i + 1]) % mod;
    printf("%d\n", count);
  }
  return 0;
}
