class Solution {
public long solution(int a, int b) {
long answer = 0;
if(a == b) {
return a;
}
long front = Math.min(a,b);
long back = Math.max(a,b);
front--;
front = (front * (front+1))/2;
back = (back * (back+1))/2;
return back-front;
}
}