    #include <bits/stdc++.h>
    #define IOS         ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    typedef unsigned long long      ll;
    #define rep(i,n)     for(int i=0;i<n;i++)
    #define gcd(a,b)       __gcd(a,b)
    #define lcm(a,b)	(a*b)/gcd(a,b)
    #define mem1(a)        memset(a,-1,sizeof(a))
    #define mem0(a)        memset(a,0,sizeof(a))
    #define vint        vector<int>
    #define pb            push_back
    #define pf            push_front
    #define ppb         pop_back
    #define all(v)      v.begin(),v.end()
    #define pii         pair<int,int>
    #define pic         pair<int,char>
    #define fr            first
    #define sc         second
    #define mp         make_pair
    #define inarr(a,n)	for(ll i=0;i<n;i++)cin>>a[i];
    #define showarr(a,x,y)	 for(ll i=x;i<y;i++)cout<<a[i]<<" ";
    #define PI   		3.1415926535897
    #define time_passed	1.0 * clock() / CLOCKS_PER_SEC
    using namespace std;

    double power(double a,int b) {if(b==0){return 1;}else if(b%2==0){return power(a*a,b/2);}else if(b%2==1){return a*power(a*a,(b-1)/2);}}
    bool cmp(pair<int,int>a,pair<int ,int> b){return a.second>b.second;}
    template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.x>>a.y;return in;}
    template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.x<<" "<<a.y;return out;}
    template<typename T,typename T1>T maxs(T &a,T1 b){if(b>a)a=b;return a;}
    template<typename T,typename T1>T mins(T &a,T1 b){if(b<a)a=b;return a;}

    /*double f(double x,double Nu,double k){return power(x,k)-Nu;}
    double fd(double x,double Nu,double k){return k*pow(x,k-1);}
    double root(int Nu,int k){double ans=9;for(int i=1;i<20;i++){ans=ans-f(ans,Nu,k)/fd(ans,Nu,k);cout<<ans<<" ";}return ans;}
    */


    const ll mod=1e9+7;
    //const int inf=3e5+5;
    //const ll inf=1e9+7;
    int dy[]={-1,0,1,0};
    int dx[]={0,1,0,-1};
    //vector <int >adj[0];
    bool isprime(int n)
    {
        if(n==1)return false;
        if(n==2) return true;
        for(int i=2;i*i<=n;i++)
        {
            if(n%i==0)return false;
        }
        return true;

    }

    void love_for_infinity()
    {

        int a,b,c,d;
        cin>>a>>b>>c>>d;
        cout<<min(min(a,b),min(c,d));

    }



    int main()
    {    IOS
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
        #ifdef SIEVE
        sieve();
        #endif
        #ifdef NCR
        init();
        #endif
        ll t;t=1;//cin>>t;
        while(t--){love_for_infinity();cout<<endl;}
        return 0;
    }


#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ub              upper_bound
#define lb              lower_bound
#define isrt            insert
#define clr             clear
#define rsz             resize
#define ff              first
#define ss              second
#define lli             long long int
#define pb              push_back
#define pf              push_front
#define mkp              make_pair
#define pii             pair<lli,lli>
#define vi              vector<int>
#define mii             map<lli,lli>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define INF             1e9
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(v)          v.begin(),v.end()
#define endl            "\n"
const double PI = acos(-1);

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

lli maxm(lli a, lli b)
{
  return (a >= b ? a : b);
}


lli minm(lli a, lli b)
{
  return (a <= b ? a : b);
}

lli power(lli x, lli y, lli p)
{
  lli res = 1;

  x = x % p;
  if (x == 0)
    return 0;

  while (y > 0)
  {

    if (y & 1)
      res = (res * x) % p;


    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}

#define FMAX 1000010
vector<lli> fact(FMAX, 1);
vector<lli> fact_inv(FMAX, 1);

lli nCrmodp(lli n, lli r, lli p)
{
  if (r > n)
    return 0;

  lli pro = (fact[n] * fact_inv[r]) % p;
  pro = (pro * fact_inv[n - r]) % mod;
  return pro;
}
void precompute()
{
  lli x = 1;
  for (lli i = 1; i < FMAX; ++i)
  {
    x *= i;
    x %= mod;
    fact[i] = x;
    fact_inv[i] = power(x, mod - 2, mod);
  }
}


void c_p_c()
{
  precompute();
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}

int main()
{
  c_p_c();

  vector<int>v(4);
  int ans= 1e9;
  for (int i = 0; i < 4; ++i)
  {
    cin >> v[i];
    ans = min(ans, v[i]);
  }
  cout << ans << endl;
  return 0;
}