summaryrefslogtreecommitdiffstats
path: root/šola/p1/dn/DN01_63230317.java
blob: d7f06592ea0fb828fc1bdba00af991816f2f8dfc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import java.util.*;
public class DN01_63230317 {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (b < a) {
			a += b;
			b = a-b;
			a -= b;
		}
		System.out.println((a-1)*(a*b)-(a-1)*a/2*(a+b)+(a-1)*a*(2*(a-1)+1)/6);
	}
}