#include <bits/stdc++.h>
using namespace std;
int top;
int t[10000];
long long sum[100000];
int ans[5002][5002];
const int MOD = 1e9 + 7;
int main() {
  int n, a, b, k;
  scanf("%d%d%d%d", &n, &a, &b, &k);
  if (a < b)
    top = b - 1;
  else
    top = abs(n - b);
  for (int i = 1; i <= top; i++) {
    int far = i * 2 - 1;
    if (far <= top)
      ans[i][1] = 2 * (i - 1);
    else
      ans[i][1] = i - 1 + (top - i);
  }
  for (int i = 1; i <= top; i++) sum[i] = (sum[i - 1] + t[i]) % MOD;
  for (int j = 2; j <= k; j++) {
    for (int q = 1; q <= top; q++) sum[q] = (sum[q - 1] + ans[q][j - 1]) % MOD;
    for (int i = 1; i <= top; i++) {
      int far = i * 2 - 1;
      if (far <= top)
        ans[i][j] = (sum[i - 1] + sum[far]) % MOD - sum[i];
      else
        ans[i][j] = (sum[i - 1] + sum[top]) % MOD - sum[i];
      ans[i][j] = ans[i][j] % MOD;
    }
  }
  printf("%d\n", (ans[abs(a - b)][k] + MOD) % MOD);
}
