def main():
    n, a, b, t = map(int, input().split())
    b += 1
    l = [b if char == "w" else 1 for char in input()]
    t -= sum(l) - a * (n + 2)
    hi, n2 = n, n * 2
    n3 = n2 + 1
    lo = res = 0
    l *= 2
    while lo <= n and hi < n2:
        t -= l[hi]
        hi += 1
        b = hi - n
        while lo < b or (hi - lo + (hi if hi < n3 else n3)) * a > t:
            t += l[lo]
            lo += 1
            n3 -= 1
        if res < hi - lo:
            res = hi - lo
            if res == n:
                break
    print(res)


if __name__ == '__main__':
    main()
