#include <iostream>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <algorithm>    
using namespace std; 
int main(int argc, char** argv)
{
	int r,p,q,a,b,c,br,nzspq,nzspqr,j,i;
	long int l,n;
	br=0;
	cin>>p>>q>>r>>l>>n;
	i=l;
	nzspq=(p*q)/__gcd(p,q);
	nzspqr=(nzspq*r)/__gcd(nzspq, r);
	if (nzspqr<n)
	{ 
		while (i<=nzspqr)
	{
		a=p-(i%p);
		b=q-(i%q);
		c=r-(i%r);
		if (i%p==0)
		{a=0;}
		if (i%q ==0)
		{b=0;}
		if (i%r ==0)
		{c=0;}
		if(((a)*(nzspqr/p)+(b)*(nzspqr/q)+(c)*(nzspqr/r))/nzspqr<=1)
		{
			br++;
		} 
	i++;
	}
	j=((n+1-l)/br)+1;
	while (j<=n)
	{
		if((a*(nzspqr/p)+b*(nzspqr/q)+c*(nzspqr/r))/nzspqr<1)
		{
			br++;
		}
		if((a*(nzspqr/p)+b*(nzspqr/q)+c*(nzspqr/r))/nzspqr==1)
		{
			if((a*(nzspqr/p)+b*(nzspqr/q)+c*(nzspqr/r))%nzspqr==0)
			{
			br++;
			}
		} 
	j++;
	}
	}
	else
	{
		while (i<=n)
	{
		
		a=p-(i%p);
		b=q-(i%q);
		c=r-(i%r);
		if (i%p==0)
		{a=0;}
		if (i%q ==0)
		{b=0;}
		if (i%r ==0)
		{c=0;}
		if((a*(nzspqr/p)+b*(nzspqr/q)+c*(nzspqr/r))/nzspqr<1)
		{
			br++;
		}
		if((a*(nzspqr/p)+b*(nzspqr/q)+c*(nzspqr/r))/nzspqr==1)
		{
			if((a*(nzspqr/p)+b*(nzspqr/q)+c*(nzspqr/r))%nzspqr==0)
			{
			br++;
			}
		}
	i++;
	}
		
	}
	cout<<br;
	return 0;
}