def main(): import sys input = sys.stdin.read().split() ptr = 0 N = int(input[ptr]) ptr += 1 a, b, c = map(int, input[ptr:ptr+3]) ptr += 3 S = input[ptr:ptr+N] # Compute prefix sums sum_ = [0] * (N + 1) pre_sum_dict = {0: 0} current_sum = 0 for i in range(1, N + 1): current_sum += len(S[i-1]) sum_[i] = current_sum pre_sum_dict[current_sum] = i # Since sum is strictly increasing, overwriting is not needed ans = 0 for R in range(1, N + 1): sum_R = sum_[R] sum_x_target = sum_R - b - c if sum_x_target not in pre_sum_dict: continue x = pre_sum_dict[sum_x_target] sum_y_target = sum_x_target + b # which should equal sum_R - c if sum_y_target not in pre_sum_dict: continue y = pre_sum_dict[sum_y_target] # Check if x < y and y < R if not (x < y and y < R): continue sum_L1 = sum_x_target - a if sum_L1 not in pre_sum_dict: continue ans += 1 print(ans) if __name__ == "__main__": main()