#include <bits/stdc++.h>
using namespace std;
long long s[3][5005], f[5005][5005];
int now, n, k, a, b;
long long cal(int i, int x, int now) {
  long long ans = 0;
  if (x == b) return 0;
  if (x > b) {
    if (x - b - 1 <= 1)
      ans = -s[now][x];
    else
      ans = -s[now][x - (x - b - 1) / 2 - 1] - f[i - 1][x];
    ans = (ans + s[now][n] + 1000000007) % 1000000007;
  } else {
    if (b - x - 1 <= 1)
      ans = s[now][x - 1];
    else
      ans =
          (s[now][x + (b - x - 1) / 2] - f[i - 1][x] + 1000000007) % 1000000007;
  }
  return (ans + 1000000007) % 1000000007;
}
int main() {
  cin >> n >> a >> b >> k;
  now = 0;
  f[0][a] = 1;
  for (int i = a; i <= n; i++) s[now][i] = 1;
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j <= n; j++) {
      f[i][j] = cal(i, j, now) % 1000000007;
      s[now ^ 1][j] = (s[now ^ 1][j - 1] + f[i][j]);
    }
    now ^= 1;
  }
  cout << (s[now][n] + 1000000007) % 1000000007 << endl;
  return 0;
}
