题目描述
You are given two sequences of integers of length $N$: $A = (A_1, A_2, \ldots, A_N)$ and $B = (B_1, B_2, \ldots, B_N)$.
Print the number of pairs of integers $(l, r)$ that satisfy $1 \leq l \leq r \leq N$ and the following condition.
- $\min\lbrace A_l, A_{l+1}, \ldots, A_r \rbrace + (B_l + B_{l+1} + \cdots + B_r) \leq S$
### Constraints
- $1 \leq N \leq 2 \times 10^5$
- $0 \leq S \leq 3 \times 10^{14}$
- $0 \leq A_i \leq 10^{14}$
- $0 \leq B_i \leq 10^9$
- All values in the input are integers.