#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;


int main() {
  int a , b, c, d;
  cin >> a >> b >> c >> d;
  int s = min(a,b);
  int t = min(c,d);
  cout << s+t << endl;
  return 0;
}
#include <bits/stdc++.h>
using namespace std;

int main(){
  int64_t A,B;
  int K;
  cin >> A >> B >> K;
  while(K>0){
    A/=2;
    B+=A;
    K--;
    if(K==0){
      break;
    }
    B/=2;
    A+=B;
    K--;
  }
  cout << A << " " << B << endl;
  return 0;
}
