You are given a sequence of N integers a1,a2,…,aN and an integer K. Your task is to count the number of intervals [l,r] such that al+ar+min(al,al+1,…,ar)≤K.
Input format
Output format
Constraints
1≤N≤5×105, 80% test cases N≤2×105
1≤K≤1018
1≤ai≤1018
There are five intervals satisfy the condition: