t=[int(i)*int(i) for i in input().split()] s=[int(i) for i in input().split()] total=sum(t)-sum(s) print(total)