#include <stdio.h>
int Result(int x,int y,int z,int j){
    printf("%d",(x+y-z)*j);
    return 0;
}
int main() {
    int a, b, c, d;
    scanf("%d %d %d %d", &a, &b, &c, &d);
    Result(a,b,c,d);
    return 0;
}