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

#include <iostream>
#include <iomanip>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <array>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <string>

#define foi(i,a,b) for(int i=a;i<=b;++i)
#define iof(i,a,b) for(int i=a;i>=b;--i)
#define fol(i,a,b) for(int i=a;i<=b;++i)
#define lof(i,a,b) for(int i=a;i>=b;--i)

using namespace std;

typedef long long LL;
typedef unsigned long long uLL;
typedef unsigned int u32;
typedef unsigned short u16;

typedef pair<int,int> PII;
typedef pair<LL,int> PLI;
typedef pair<int,LL> PIL;
typedef pair<LL,LL> PLL;

const int Inf=(1<<30)-1;
const LL lInf=(1LL<<62)-1;
const int mInf=0x7f7f7f7f;

int main()
{
	ios::sync_with_stdio(false);
	
	int minn=Inf;
	for(int a,i=1;i<=4;i++) cin>>a,minn=min(minn,a);
	cout<<minn<<endl;
	
	return 0;
}