#include<iostream>
using namespace std;

int main(){
  int A[4];
  cin>>A[0]>>A[1]>>A[2]>>A[3];
  int t=100;
  for(int i=0; i<4; i++){
    if(t>A[i]){t=A[i];}
  }
  cout<<t<<endl;
  return 0;
}
#include<bits/stdc++.h>
using namespace std ;
int main(){
  int a,b,c,d;
  cin>>a>>b;
  cin>>c>>d;
  cout<<b-c<<endl;
}