All problems

Building a Multiplication Table

mediumPythonNumPynp.outer

Bramley Catering has to quote for a wedding before either the guest count or the menu has been settled. The planner keeps a shortlist of possible guest counts and a shortlist of possible per-head prices, and wants a single grid she can read across the table: one row for each guest count on her shortlist, in the order she wrote it, and one column for each per-head price, in the order she wrote it. The entry where a row meets a column is what that many guests would cost at that price per head.

Task: Print the quote grid.

Input

Two lines. The first holds the guest counts, whole numbers separated by single spaces. The second holds the per-head prices, whole numbers separated by single spaces. The two lines need not hold the same number of values.

Output

One line per guest count, in the order given, each holding that row's totals separated by single spaces — one total per per-head price, in the order given. Write each total as a plain integer.

Example:

Input:
1 2 3
1 2

Output:
1 2
2 4
3 6

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…