#include<iostream> using namespace std; int main() { int a1,a2,n,d; cin>>a1>>a2>>n>>d; d=a2-a1; cout<<(n-1)*d+a1; return 0; }