#include <stdio.h>
int main() {
// your code goes here
int num1,num2,mul,i; //we are multiplying num1 with num2
char multiSign;
fflush(stdin);
scanf("%d%c%d",&num1,&multiSign,&num2);
int sum=0;
while(num2!=0)
{
mul=num1*(num2%10);
printf("%d\n",mul);
sum=sum+mul;
num2=num2/10;
}
i=sum;
while(i!=0)
{
printf("-"); //this will print "-" for required number of times
i=i/10;
}
printf("\n%d",sum);
return 0;
}