#include <bits/stdc++.h>
using namespace std;
int t, maxx = -1, l, r, mid, n, a, b, ans = 0;
char c[50010], c1;
bool d[50010];
int ds(int o) {
  if (c[o] == 'h')
    return 1;
  else
    return b + 1;
}
bool search(int x, int y, int v) {
  if (y == mid) return true;
  if (y * a + ds(x - y) > v && a + ds(x + 1) > v)
    return false;
  else if (a + ds(x + 1) <= v && y * a + ds(x - y) > v) {
    d[x + 1] = 0;
    if (search(x + 1, y + 1, v - a - ds(x + 1))) return true;
    d[x + 1] = 1;
  } else if (a + ds(x + 1) > v && y * a + ds(x - y) <= v) {
    d[x - y] = 0;
    if (search(x - y, y + 1, v - y * a - ds(x - y))) return true;
    d[x - y] = 1;
  } else {
    d[x + 1] = 0;
    if (search(x + 1, y + 1, v - a - ds(x + 1))) return true;
    if (search(x - y, y + 1, v - y * a - ds(x - y))) return true;
    d[x - y] = 1;
  }
  return false;
}
int main() {
  scanf("%d%d%d%d", &n, &a, &b, &t);
  for (int i = 0; i <= n; ++i) {
    scanf("%c", &c[i]);
    c[i + n] = c[i];
  }
  l = 1;
  r = n;
  if (t - ds(n + 1) >= 0)
    while (l <= r) {
      for (int i = 2; i <= 2 * n - 1; ++i) d[i] = 1;
      d[1 + n] = 0;
      mid = (l + r) / 2;
      if (search(1 + n, 1, t - ds(n + 1)))
        ans = mid, l = mid + 1;
      else
        r = mid - 1;
    }
  printf("%d", ans);
}
