#include <bits/stdc++.h>
using namespace std;
#define lol long long
#define mod 1000000007
#define Fast            ios_base::sync_with_stdio(false);cin.tie(0);
#define rep(i, x, y)    for (lol i = x; i <= y; i++)
#define repi(i, x, y)   for (lol i = x; i >= y; i--)
#define TC(x)           sci(x); while (x--)
#define sci(x)          lol x; cin>>x;
#define scii(x, y)      lol x, y; cin>>x>>y;
#define sciii(x, y, z)  lol x, y, z; cin>>x>>y>>z;
#define F first
#define S second
#define mp make_pair
#define pb push_back
int main(){
    Fast;
    scii(x, y);
    x = min(x, y);
    scii(z, w);
    z = min(z, w);
    cout << min(x, z)<<"\n";
}
/*##





*/
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int A, B, C, D;
  cin>>A>>B>>C>>D;
  cout<<min(A, min(B, min(C, D)))<<endl;
}

