Editorial
Problem Author: | Pavlo Tsytsi |
Problem Prepared by: | Pavlo Tsytsi |
Editorial by: | Pavlo Tsytsi |
. The part we need is in the second set of parentheses, so all we need is the square of the sum on the segment and the sum of squares on the segment. This can be found using prefix sum. After that, divide by 2 modulo.