you give n segment coordinate axis the ith segment l_i r_i let denote set integer point belong ith segment s_ilet a cup b union set a B a cap b intersection set a B a oplus b symmetric difference A b set contain element a element b one belong setsLet mathbinop_1 mathbinop_2 dot mathbinop_n1 array element cup oplus cap over 3n1 way choose array calculate sum follow valuess_1 mathbinop_1 S_2 mathbinop_2 S_3 mathbinop_3 S_4 dot mathbinop_n1 s_nin expression S denote size set S