#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
#define mod 1313
struct node
{
int d;
struct node*next;
};
node *pt[mod + 10];
int a,b,c,d,e;
int x,y,z,n,m;
int main()
{
int ans1 = 0,f = 0, ans2 = 0;
while(scanf("%d %d %d %d %d",&a, &b, &c, &d, &e) != EOF)
{
memset(pt,0,sizeof(pt));
int num = 0;
for ( int i = -50; i <= 50; i++)
if(i!=0)
for( int j = -50; j <= 50 ; j++)
if(j!=0)
{
f = a*i*i*i + b*j*j*j;
//cout<<f<<endl;
ans1 = ( f > 0 ? f : -f)%mod;
node *pnt = new node;
pnt->d = f;
pnt->next = pt[ans1];
pt[ans1] = pnt;
}
for ( int i = -50; i <= 50; i++)
if(i)
for( int j = -50; j <= 50; j++)
if(j)
for( int k = -50; k <= 50 ; k++)
if(k)
{
f = -(c*i *i*i + d*j*j*j + e*k*k*k );
ans2 = ( f > 0 ? f : -f)%mod;
node *pnt = pt[ans2];
while(pnt)
{
if(pnt -> d == f)
{
++num;
// cout<<"ASd"<<endl;
}
pnt = pnt->next;
}
}
printf("%d\n",num);
}
return 0;
}
#include <stdio.h>
#include <string.h>
using namespace std;
#define mod 1313
struct node
{
int d;
struct node*next;
};
node *pt[mod + 10];
int a,b,c,d,e;
int x,y,z,n,m;
int main()
{
int ans1 = 0,f = 0, ans2 = 0;
while(scanf("%d %d %d %d %d",&a, &b, &c, &d, &e) != EOF)
{
memset(pt,0,sizeof(pt));
int num = 0;
for ( int i = -50; i <= 50; i++)
if(i!=0)
for( int j = -50; j <= 50 ; j++)
if(j!=0)
{
f = a*i*i*i + b*j*j*j;
//cout<<f<<endl;
ans1 = ( f > 0 ? f : -f)%mod;
node *pnt = new node;
pnt->d = f;
pnt->next = pt[ans1];
pt[ans1] = pnt;
}
for ( int i = -50; i <= 50; i++)
if(i)
for( int j = -50; j <= 50; j++)
if(j)
for( int k = -50; k <= 50 ; k++)
if(k)
{
f = -(c*i *i*i + d*j*j*j + e*k*k*k );
ans2 = ( f > 0 ? f : -f)%mod;
node *pnt = pt[ans2];
while(pnt)
{
if(pnt -> d == f)
{
++num;
// cout<<"ASd"<<endl;
}
pnt = pnt->next;
}
}
printf("%d\n",num);
}
return 0;
}