import java.util.*;
import java.io.*;
public class Main {
	
	
	public static void calTiredness(int d) {
		
		
		if(d == 1) {
			
			System.out.println(1);
			
		} else if(d%2 == 0) {
			
			System.out.println((1+d/2)/2*d);
			
		} else {
			
			int m = (d+1)/2;
			System.out.println(m*(m+1)-m);
			
		}
		
	}
	
	
  public static void main(String[] args) {
    
	Scanner sc = new Scanner(System.in);
	int a = sc.nextInt();
	int b = sc.nextInt();
	int d = Math.abs(a - b);
	
	calTiredness(d);
	  
    }
  }