#include <stdio.h>
int xiangqin(int x) {
	printf("%d,",x);
	int i,result = 1;
	for(i = x; i > 1; i--) {
		if(x % i == 0 && i != 1 && i != x) {
			printf("%d+",i);
			result += i;
		}
	}
	printf("1=%d\n",result);
	return result;
}

int main() {
	int a,b;
	scanf("%d %d",&a,&b);
	
	int xa = xiangqin(a);
	int xb = xiangqin(b);
	if(xa == b && xb == a) printf("1");
	else printf("0");
	
	return 0;
}