#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int a,b,i,j,s=0,p=0;
scanf("%d%d",&a,&b);
printf("%d,1",a);
for(i=1;i<a;i++)
{ if(a%i==0)
{
s=s+i;
if(i!=1)
printf("+%d",i);
}
}
printf("=%d\n",s);
printf("%d,1",b);
for(j=1;j<b;j++)
{ if(b%j==0)
{
p=p+j;
if(j!=1)
printf("+%d",j);
}
}
printf("=%d\n",p);
if(s==b&&p==a) printf("1");
else printf("0");
return 0;
}