#include <bits/stdc++.h>
using namespace std;
long long pwr(long long a, long long b, long long mod) {
  a %= mod;
  if (a < 0) a += mod;
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    b /= 2;
  }
  return ans;
}
long long pwr(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans *= a;
    a *= a;
    b /= 2;
  }
  return ans;
}
long long gcd(long long a, long long b) {
  while (b) {
    long long temp = a;
    a = b;
    b = temp % b;
  }
  return a;
}
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
long long modularInverse(long long a, long long m) {
  assert(false);
  return pwr(a, m - 2, m);
}
const int mod = 1000000007;
int DP[5001][5001];
int PDP[5001][5001];
int n, k, a, b;
void generatePDP(int u) {
  PDP[u][0] = DP[u][0];
  for (int i = 1; i <= n; ++i) {
    PDP[u][i] = (PDP[u][i - 1] + DP[u][i]) % mod;
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  cin >> n >> a >> b >> k;
  for (int i = 1; i <= n; ++i) DP[0][i] = 1;
  DP[0][b] = 0;
  for (int i = 1; i <= k; ++i) {
    generatePDP(i - 1);
    for (int j = 1; j <= n; ++j) {
      if (j == b) {
        DP[i][b] = 0;
      } else if (j < b) {
        int dist = b - j;
        int start = max(1, j - dist + 1);
        int end = b - 1;
        if (start - 1 >= 1)
          DP[i][j] = PDP[i - 1][end] - PDP[i - 1][start - 1] - DP[i - 1][j];
        else
          DP[i][j] = PDP[i - 1][end] - DP[i - 1][j];
      } else if (j > b) {
        int dist = j - b;
        int start = b + 1;
        int end = min(j + dist - 1, n);
        if (start - 1 >= 1)
          DP[i][j] = PDP[i - 1][end] - PDP[i - 1][start - 1] - DP[i - 1][j];
        else
          DP[i][j] = PDP[i - 1][end] - DP[i - 1][j];
      }
      DP[i][j] %= mod;
      if (DP[i][j] < 0) DP[i][j] += mod;
    }
  }
  cout << DP[k][a] << endl;
}
