#include <stdio.h>

/* calcula x^i */
double Pot( double x, int i) {
  double pot;
  int j;
  
  pot = 1;
  for ( j = 0; j < i; j++ )
    pot = pot * x;
  
  return pot;
}


int main () {
  double x, y;
  int a, b;
  
  scanf ( "%lf %lf %d %d", &x, &y, &a, &b );

  /* imprime x^a + y^b + (x-y)^{a+b} */
  printf ( "%g\n", Pot( x, a ) + Pot( y, b ) + Pot( x - y, a + b ) );

  return 0;
}