#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 7, inf = 1e9 + 7, mod = 1e9 + 7;
int n, r, s, m, a[maxn], dl[maxn], dr[maxn], ans;
int p(int pos) { return pos % n; }
int main() {
  scanf("%d%d%d%d", &n, &s, &r, &m);
  for (int i = 0; i < n; ++i) {
    char c;
    scanf(" %c", &c);
    a[i] = (c == 'h' ? 1 : 1 + r);
  }
  if (a[0] > m) {
    printf("0");
    return 0;
  }
  ans = 1;
  dl[0] = dr[0] = a[0];
  for (int i = 1; i < n; ++i) {
    dr[i] = dr[i - 1] + s + a[i];
  }
  for (int i = n - 1; i >= 1; --i) {
    dl[i] = dl[p(i + 1)] + s + a[i];
  }
  dl[0] = dr[0] = 0;
  int id;
  id = n;
  for (int i = n - 1; i >= 1; --i) {
    if (dl[i] > m) break;
    id = i;
  }
  for (int i = 1; i < n; ++i) {
    while (dr[i] + dl[id] + i * s * (id != n) - (id != n) * a[0] > m and
           id != n) {
      ++id;
    }
    if (dr[i] + dl[id] + i * s * (id != n) - (id != n) * a[0] > m) break;
    if (i >= id) {
      printf("%d", n);
      return 0;
    }
    ans = max(ans, i + n - id + 1);
  }
  id = 0;
  for (int i = 1; i < n; ++i) {
    if (dr[i] > m) break;
    id = i;
  }
  for (int i = n - 1; i >= 1; --i) {
    while (dl[i] + dr[id] + (n - i) * s * (id != 0) - (id != 0) * a[0] > m and
           id != 0) {
      --id;
    }
    if (dl[i] + dr[id] + (n - i) * s * (id != 0) - (id != 0) * a[0] > m) break;
    if (i <= id) {
      printf("%d", n);
      return 0;
    }
    ans = max(ans, id + n - i + 1);
  }
  printf("%d", ans);
  return 0;
}
