//ak =[k(1+√5)/2],bk= ak + k (k=0,1,2,...n 方括号表示取整函数)
//即(bk-ak)==ak*(√5-1)/2 或 (bk-ak)+ 1==ak*(√5-1)/2即输
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std ;
int main()
{
int n , m;
while(~scanf("%d%d",&n ,&m))
{
int mi = min(n ,m) ;
int ma = max(n , m) ;
int k = ma -mi ;
int t = (double)mi*((sqrt((double)5)-1)/2);
if(t == k || t+1 == k)
printf("0\n") ;
else printf("1\n") ;
}
return 0;
}