local n = io.read("*n") local a, b, c = io.read("*n", "*n", "*n", "*l") local s = io.read() local t = {} for w in s:gmatch("%w+") do table.insert(t, #w) end for i = 2, n do t[i] = t[i - 1] + t[i] end local ret = 0 local offset = 0 local ap, bp, cp = 1, 1, 1 for i = 1, n do while ap <= n and t[ap] < offset + a do ap = ap + 1 end if n < ap then bp = ap else while bp <= n and t[bp] < t[ap] + b do bp = bp + 1 end end if n < bp then cp = bp else while cp <= n and t[cp] < t[bp] + c do cp = cp + 1 end end if ap <= n and bp <= n and cp <= n and t[cp] - t[bp] == c and t[bp] - t[ap] == b and t[ap] - offset == a then ret = ret + 1 end offset = t[i] end print(ret)