// Arup Guha
// Solution to 2011 MCPC Problem A: Grade School Multiplication
// 10/6/2013

import java.util.*;

public class a {

	final static int MAXLEN = 15;

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		String op1 = stdin.next();
		String op2 = stdin.next();
		int loop = 1;

		// Go through each case.
		while (!op1.equals("0")) {

			// Print header.
			System.out.println("Problem "+loop);

			// Do each step and print.
			char[] op1Array = getArray(op1);
			char[] op2Array = getArray(op2);
			char[][] steps = getSteps(op1Array, op2Array);
			long ans = (Long.parseLong(op1))*(Long.parseLong(op2));
			int ansLength = getLen(ans);
			printResult(op1Array, op2Array, steps, ans, ansLength);

			// Get next case.
			op1 = stdin.next();
			op2 = stdin.next();
			loop++;
		}
	}

	// Pre-condition: len(s) <= MAXLEN.
	// Returns array form of s.
	public static char[] getArray(String s) {
		char[] ans = new char[s.length()];
		for (int i=0, j=s.length()-1; j>=0; i++,j--)
			ans[i] = s.charAt(j);
		return ans;
	}

	// Returns the number of digits in val.
	public static int getLen(long val) {
		int ans = 0;
		while (val > 0) {
			ans++;
			val /= 10L;
		}
		return ans;
	}

	// Stores all steps of multiplication between op1Array and op2Array and returns them.
	public static char[][] getSteps(char[] op1Array, char[] op2Array) {

		// Set up grid.
		int rows = getRows(op2Array);
		char[][] ans = new char[rows][MAXLEN];
		for (int i=0; i<rows; i++) Arrays.fill(ans[i], ' ');

		// Go through each digit of op2.
		int j = 0, cur = 0;
		for (int i=0; i<op2Array.length; i++) {

			// This is where we form a new row.
			if (op2Array[i] > '0') {

				// Do regular algorithm to fill in this row.
				int carry = 0, loop;
				for (loop=cur; loop<cur+op1Array.length; loop++) {
					int curProduct = (op2Array[i]-'0')*(op1Array[loop-cur]-'0');
					ans[j][loop] = (char)((carry + curProduct)%10 +'0');
					carry = (carry + curProduct)/10;
				}

				// Store last carry, if necessary.
				if (carry > 0) ans[j][loop] = (char)(carry+'0');
				j++;
			}

			// This is what the rules tell you to do.
			else {
				ans[j][cur] = '0';
			}

			// Go to the next slot.
			cur++;
		}

		// Here is our answer.
		return ans;
	}

	// Returns the number of non-zero digits in array, assuming array only has digits.
	public static int getRows(char[] array) {
		int cnt = 0;
		for (int i=0; i<array.length; i++)
			if (array[i] > '0')
				cnt++;
		return cnt;
	}

	// Prints in the desired format.
	public static void printResult(char[] op1Array, char[] op2Array, char[][] steps, long ans, int ansLength) {

		// Print the top.
		printRow(op1Array, ansLength);
		printRow(op2Array, ansLength);
		for (int i=0; i<ansLength; i++) System.out.print("-");
		System.out.println();

		// Print the steps with no trailing spaces.
		for (int i=0; i<steps.length; i++) {
			boolean flag = false;
			for (int j=ansLength-1; j>=0; j--) {
				if (!flag || steps[i][j] != ' ') System.out.print(steps[i][j]);
				if (steps[i][j] != ' ') flag = true;
			}
			System.out.println();
		}

		// Only if we need to sum separate items.
		if (steps.length > 1) {
			for (int i=0; i<ansLength; i++) System.out.print("-");
			System.out.println();
			System.out.println(ans);
		}
	}

	// Prints one row, padded with spaces with width characters total.
	public static void printRow(char[] array, int width) {
		for (int i=width-1; i>=array.length; i--) System.out.print(' ');
		for (int i=array.length-1; i>=0; i--) System.out.print(array[i]);
		System.out.println();
	}
}