Sum the lengths of the intersections of all k-subsets of given segments, modulo 1e9+7.
There are NNN one dimensional segments on a horizontal line. Call the iii-th segment [Li,Ri][L_i, R_i][Li,Ri] (Li≤RiL_i \le R_iLi≤Ri). The length of a segment is f([Li,Ri])=Ri−Li+1f([L_i, R_i]) = R_i - L_i + 1f([Li,Ri])=Ri−Li+1, and the length of the empty set is f(∅)=0f(\varnothing) = 0f(∅)=0.
You are given a positive integer kkk with k≤Nk \le Nk≤N. For every way of choosing kkk distinct segments, add up the length of the intersection of the chosen segments:
∑1≤i1<i2<⋯<ik≤Nf([Li1,Ri1]∩[Li2,Ri2]∩⋯∩[Lik,Rik])\sum_{1 \le i_1 < i_2 < \cdots < i_k \le N} f\bigl([L_{i_1}, R_{i_1}] \cap [L_{i_2}, R_{i_2}] \cap \cdots \cap [L_{i_k}, R_{i_k}]\bigr)∑1≤i1<i2<⋯<ik≤Nf([Li1,Ri1]∩[Li2,Ri2]∩⋯∩[Lik,Rik])
Write a program that computes this sum.
The answer can be very large, so print it modulo 109+710^9 + 7109+7.
The first line contains NNN and kkk. (1≤k≤N≤200,0001 \le k \le N \le 200{,}0001≤k≤N≤200,000)
Each of the next NNN lines contains two integers LiL_iLi and RiR_iRi describing the iii-th segment. (−109≤Li≤Ri≤109-10^9 \le L_i \le R_i \le 10^9−109≤Li≤Ri≤109)
Print on one line the sum of the intersection lengths over every way of choosing kkk distinct segments, modulo 109+710^9 + 7109+7.
When the segments are [1,2][1, 2][1,2], [1,3][1, 3][1,3], [2,3][2, 3][2,3] and k=2k = 2k=2, there are three ways to choose, and the intersection lengths are:
f([1,2]∩[1,3])=f([1,2])=2f([1,2] \cap [1,3]) = f([1,2]) = 2f([1,2]∩[1,3])=f([1,2])=2
f([1,2]∩[2,3])=f([2,2])=1f([1,2] \cap [2,3]) = f([2,2]) = 1f([1,2]∩[2,3])=f([2,2])=1
f([1,3]∩[2,3])=f([2,3])=2f([1,3] \cap [2,3]) = f([2,3]) = 2f([1,3]∩[2,3])=f([2,3])=2
So the answer is 2+1+2=52 + 1 + 2 = 52+1+2=5.