Vasya's telephone contains n photos. Photo number 1 is currently opened on the phone. It is allowed to move left and right to the adjacent photo by swiping finger over the screen. If you swipe left from the first photo, you reach photo n. Similarly, by swiping right from the last photo you reach photo 1. It takes a seconds to swipe from photo to adjacent.

For each photo it is known which orientation is intended for it — horizontal or vertical. Phone is in the vertical orientation and can't be rotated. It takes b second to change orientation of the photo.

Vasya has T seconds to watch photos. He want to watch as many photos as possible. If Vasya opens the photo for the first time, he spends 1 second to notice all details in it. If photo is in the wrong orientation, he spends b seconds on rotating it before watching it. If Vasya has already opened the photo, he just skips it (so he doesn't spend any time for watching it or for changing its orientation). It is not allowed to skip unseen photos.

Help Vasya find the maximum number of photos he is able to watch during T seconds.


-----Input-----

The first line of the input contains 4 integers n, a, b, T (1 ≤ n ≤ 5·10^5, 1 ≤ a, b ≤ 1000, 1 ≤ T ≤ 10^9) — the number of photos, time to move from a photo to adjacent, time to change orientation of a photo and time Vasya can spend for watching photo.

Second line of the input contains a string of length n containing symbols 'w' and 'h'. 

If the i-th position of a string contains 'w', then the photo i should be seen in the horizontal orientation.

If the i-th position of a string contains 'h', then the photo i should be seen in vertical orientation.


-----Output-----

Output the only integer, the maximum number of photos Vasya is able to watch during those T seconds.


-----Examples-----
Input
4 2 3 10
wwhw

Output
2

Input
5 2 4 13
hhwhh

Output
4

Input
5 2 4 1000
hhwhh

Output
5

Input
3 1 100 10
whw

Output
0



-----Note-----

In the first sample test you can rotate the first photo (3 seconds), watch the first photo (1 seconds), move left (2 second), rotate fourth photo (3 seconds), watch fourth photo (1 second). The whole process takes exactly 10 seconds.

Note that in the last sample test the time is not enough even to watch the first photo, also you can't skip it.

Difficulty: competition

Starter code:

Solutions:
def main():
    n, a, b, t = list(map(int, input().split()))
    a1 = a + 1
    b += a1
    l, res = [b if c == "w" else a1 for c in input()], []
    l[0] = x = l[0] - a
    if t <= x:
        print(int(t == x))
        return
    f = res.append
    for dr in 0, 1:
        if dr:
            l[1:] = l[-1:-n:-1]
        tot = t
        for hi, x in enumerate(l):
            tot -= x
            if tot < 0:
                break
        else:
            print(n)
            return
        f(hi)
        tot += x
        hi -= 1
        tot -= hi * a
        lo = n
        while True:
            while lo > 0 <= tot:
                lo -= 1
                tot -= l[lo]
            f(n + hi - lo)
            if not (lo and hi):
                break
            while tot <= 0 < hi:
                tot += l[hi] + a
                hi -= 1
    print(max(res))


def __starting_point():
    main()

__starting_point()

def main():
    n, a, b, t = list(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
        while (hi - lo + (hi if hi < n3 else n3)) * a > t or lo < hi - n:
            t += l[lo]
            lo += 1
            n3 -= 1
        if res < hi - lo:
            res = hi - lo
            if res == n:
                break
    print(res)


def __starting_point():
    main()

__starting_point()

def main():
    n, a, b, t = list(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
        while (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:
                res = n
                break
    print(res)


def __starting_point():
    main()

__starting_point()

read = lambda: list(map(int, input().split()))
per = lambda L, R: R - L - 1 + min(R - n - 1, n - L)
n, a, b, T = read()
f = [1 + (i == 'w') * b for i in input()] * 2
L, R = 0, n
ans = 0
cur = sum(f) // 2
while L <= n and R < n * 2:
    cur += f[R]; R += 1
    while R - L > n or cur + per(L, R) * a > T:
        cur -= f[L]; L += 1
    ans = max(ans, R - L)
print(ans)


def main():
    n, a, b, t = list(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
        while (hi - lo + (hi if hi < n3 else n3)) * a > t or lo < hi - n:
            t += l[lo]
            lo += 1
            n3 -= 1
        if res < hi - lo:
            res = hi - lo
            if res == n:
                break
    print(res)


def __starting_point():
    main()




# Made By Mostafa_Khaled

__starting_point()

import sys
INF = 10**20
MOD = 10**9 + 7
I = lambda:list(map(int,input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br


"""
Facts and Data representation
Constructive? Top bottom up down
"""
n, a, b, T = I()
s = input()
A = []
B = []
time = 0
d = {'h': 1, 'w': b + 1}
for i in range(n):
  time += d[s[i]]
  A.append(time)
  time += a
time = 0
for i in range(n - 1, 0, -1):
  time += a
  time += d[s[i]]
  B.append(time)

ans = 0
# print(A, B)
for i in range(n):
  time = A[i]
  if time > T:
    break
  l = br(B, T - time - i * a)
  ans = max(ans, i + 1 + l)

B = [A[0]] + [A[0] + i for i in B]
A = [A[i] - (A[0]) for i in range(1, n)]  
# print(A, B)

for i in range(n):
  time = B[i]
  if time > T:
    break
  l = br(A, T - time - i * a)
  ans = max(ans, i + 1 + l)
print(min(n, ans))