#include
int solve (int m)
{
int ans = 0;
while(m) {
ans += (m%10)*(m%10);
m /= 10;
}
if(ans%5 ==0) return 1;
else return 0;
}
int main()
{
int m;
while(scanf("%d",&m) == 1)
printf("%dn",solve(m) );
}
#include
int solve (int m)
{
int ans = 0;
while(m) {
ans += (m%10)*(m%10);
m /= 10;
}
if(ans%5 ==0) return 1;
else return 0;
}
int main()
{
int m;
while(scanf("%d",&m) == 1)
printf("%dn",solve(m) );
}