#include <bits/stdc++.h>
int n, a, b, k;
int f[5005] = {0}, s[5005] = {0};
int main() {
  scanf("%d%d%d%d", &n, &a, &b, &k);
  f[a] = 1;
  for (int i = 1; i <= n; i++) s[i] = s[i - 1] + f[i];
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j <= n; j++) {
      if (j < b) f[j] = (s[(j + b - 1) / 2] - f[j] + 1000000007) % 1000000007;
      if (j > b)
        f[j] = ((s[n] - s[(j + b) / 2] + 1000000007) % 1000000007 - f[j] +
                1000000007) %
               1000000007;
    }
    for (int j = 1; j <= n; j++) s[j] = (s[j - 1] + f[j]) % 1000000007;
  }
  printf("%d\n", s[n]);
  return 0;
}
