#include <bits/stdc++.h>
using namespace std;
long long int dp[5010][5010];
int n;
int a;
int b;
int k;
int main() {
  scanf("%d%d%d%d", &n, &a, &b, &k);
  dp[0][a] = 1;
  dp[1][max(1, a - abs(a - b) + 1)] = 1;
  dp[1][a] += -1;
  dp[1][a + 1]++;
  dp[1][min(n + 1, a + abs(a - b))] = -1;
  if (abs(a - b) == 1) {
    cout << 0 << endl;
    return 0;
  }
  long long int ans = 0;
  for (int i = 1; i <= k; i++) {
    long long int sum = 0;
    for (int j = 1; j <= n; j++) {
      sum += dp[i][j];
      sum %= 1000000007;
      if (i == k && j != b) {
        ans += sum;
        ans %= 1000000007;
        continue;
      }
      if (j == b) {
        continue;
      }
      if (abs(j - b) == 1) {
        continue;
      }
      dp[i + 1][max(1, j - abs(j - b) + 1)] += sum;
      dp[i + 1][max(1, j - abs(j - b) + 1)] %= 1000000007;
      dp[i + 1][j] -= sum;
      dp[i + 1][j + 1] += sum;
      dp[i + 1][min(n + 1, j + abs(j - b))] += -sum;
      dp[i + 1][min(n + 1, j + abs(j - b))] %= 1000000007;
    }
  }
  while (ans < 0) {
    ans += 1000000007;
  }
  ans %= 1000000007;
  printf("%I64d\n", ans);
  return 0;
}
