Points:
300 (p)
Time limit:
1.0s
Memory limit:
512M
Input:
stdin
Output:
stdout
Test 1
Input
5 3
2 3 8 9 100
1 3
4 4
3 5
Output
10
4
10
Comments