a,b,c,d=map(int,input().split())
e=(a+b-c)*d
print(e)