#include <bits/stdc++.h>
using namespace std;
int n, a, b, k, dp[2][5010], c[5010];
int main() {
  int ans = 0;
  scanf("%d %d %d %d", &n, &a, &b, &k);
  dp[1][a] = 1;
  if (a < b) {
    for (int i = 0; i < k; ++i) {
      int minx;
      for (int j = 1; j < b; ++j) {
        c[j] = (c[j - 1] + dp[(i + 1) % 2][j]) % 1000000007;
      }
      for (int j = 1; j < b; ++j) {
        int k = abs(j - b) - 1;
        minx = j + k / 2;
        dp[i % 2][j] = (c[minx] - dp[(i + 1) % 2][j]) % 1000000007;
      }
    }
    for (int i = 0; i < b; ++i) {
      ans = (ans + dp[(k - 1) % 2][i]) % 1000000007;
    }
  } else {
    for (int i = 0; i < k; ++i) {
      int maxx;
      for (int j = n; j > b; --j) {
        c[j] = (c[j + 1] + dp[(i + 1) % 2][j]) % 1000000007;
      }
      for (int j = b + 1; j <= n; ++j) {
        int k = abs(j - b) - 1;
        maxx = j - k / 2;
        dp[i % 2][j] = (c[maxx] - dp[(i + 1) % 2][j]) % 1000000007;
      }
    }
    for (int i = b + 1; i <= n; ++i) {
      ans = (ans + dp[(k - 1) % 2][i]) % 1000000007;
    }
  }
  if (ans < 0) ans += 1000000007;
  printf("%d\n", ans % 1000000007);
  return 0;
}
