nums = eval(input())
lower = int(input())
upper = int(input())
cnt = 0
for i in range(len(nums)):
    for j in range(i, len(nums)):
        if lower <= sum(nums[i:j + 1]) <= upper:
            cnt += 1
print(cnt)

2cc38beb26f7285fe80b0664230db9182ce15984
<mask token>

<mask token>
for i in range(len(nums)):
    for j in range(i, len(nums)):
        if lower <= sum(nums[i:j + 1]) <= upper:
            cnt += 1
print(cnt)

nums = eval(input())
lower = int(input())
upper = int(input())
cnt = 0
for i in range(len(nums)):
    for j in range(i, len(nums)):
        if lower <= sum(nums[i:j + 1]) <= upper:
            cnt += 1
print(cnt)
