LearnPy Hub
← Introduction & print() problems
Hard

Times Table With Borders

Read n and print an n × n times table with a header row and column. Each cell is right-aligned in width w, where w is the number of digits in n × n. The header row starts with w spaces then |, then the numbers 1..n; then a line of dashes as long as the header; then each row as i| (i right-aligned in w) followed by the products. Separate cells with one space.

Input

One integer 1 ≤ n ≤ 12.

Output

n + 2 lines.

Sample 1

Input
3
Output
 |1 2 3
-------
1|1 2 3
2|2 4 6
3|3 6 9

Sample 2

Input
1
Output
 |1
---
1|1
solution.py
Output appears here
Times Table With Borders · Python practice problem · LearnPy Hub