#include<iostream>
using namespace std;
int main ()
{
     int n1;
     int c1;
     int n2;
     int c2;
     int k;
     int A;
     int B;
    cin>>n1>>c1>>n2>>c2>>k;
    c1=A || B;
    c2=A || B;

    n1<100;
    n1>1;
    n2<100;
    n2>1;
    k>1;
    (n1+n2)>=k;
    if(n1!=A){
        n2=A;
    }
    if(k>=n1){
        cout<<n1;
    }else if (k>n1){
        cout<<k-(k-n1);
    }
    return 0;
}
