#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
int a, b, c, d, l, count, i, e;
while(cin >> a >> b >> c >> d >> l)
{
if(a==0 && b==0 && c==0 && d==0 && l==0)
{
break;
}
count=0;
for(i=0; i<=l; i++)
{
e=((a*i*i)+(b*i)+c);
if(e%d==0)
{
count++;
}
}
cout << count<<endl;
}
return 0;
}
No comments:
Post a Comment