#include<iostream>
using namespace std;
int main()
{
    int a;///32 8+8+8+8=32
    int b;
    int c;
    int d;
    int e;
    int s=1;
    cin>>a>>b>>c>>d>>e;
    int licea=a*a*a;///1, 8
    int liceb=b*b*b;///8 ,8
    int licec=c*c*c;///27, 8
    int liced=d*d*d;///64, 8
    int licee=e*e*e;///343, 8
    int starolicee=licee;///343,
    if(licea+liceb+licec+liced<licee)
    {
      cout<<s;
    }
    if(licea+liceb+licec+liced>liced)
    {
        while(licea+liceb+licec+liced>=licee)///32>=8,32=16,32=24,32=32
        {
           licee=licee+starolicee;///8+8=16 16+8=24 24+8=32
        }
        int n=licee/starolicee ;
        cout<<n-1;
    }

    return 0;
}
