#include <bits/stdc++.h>
using namespace std;
const int N = 5005;
int n, a, b, k;
int d[3][N];
int sum[N];
int ans = 0;
int cur = 1;
int main() {
  scanf("%d%d%d%d", &n, &a, &b, &k);
  d[0][a] = 1;
  for (int cnt = 1; cnt <= k; ++cnt) {
    for (int i = 1; i <= n; ++i)
      sum[i] = (sum[i - 1] + d[cur ^ 1][i]) % 1000000007;
    for (int i = 1; i <= n; ++i) {
      if (i == b) continue;
      if (i < b) {
        int r = i + (b - i) / 2;
        if ((b - i) % 2 == 0) --r;
        d[cur][i] = (sum[r] - d[cur ^ 1][i] + 1000000007) % 1000000007;
      } else {
        int l = i - (i - b) / 2;
        if ((i - b) % 2 == 0) ++l;
        d[cur][i] = (((sum[n] - sum[l - 1] - d[cur ^ 1][i]) % 1000000007) +
                     1000000007) %
                    1000000007;
      }
    }
    cur ^= 1;
  }
  for (int i = 1; i <= n; ++i) ans = (ans + d[cur ^ 1][i]) % 1000000007;
  printf("%d\n", ans);
  return 0;
}
