import java.util.*;

public class FriendsMeet {
    public static void main (String[] args) {

        Scanner scan = new Scanner(System.in);

        int a = scan.nextInt();
        int b = scan.nextInt();
        int tiredness = 0;
        int counter = 1;

        int temp = ((a-b)/2)*-1;
        if ((a-b)%2==0) {
            for (int i=0; i<temp; i++) {
               tiredness = tiredness + counter*2;
               counter++;
           }
       }
       else {
            for (int i=0; i<temp; i++) {
               tiredness = tiredness + counter*2;
               counter++;
           }
           tiredness = tiredness + counter;
       }
       System.out.println(tiredness);

    }
}