Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/matritsa-ramka

Frame

Easy 1000 ms 128 MB 22%
Share

Two positive integers $n$ and $m$ are given. Fill every element on the border of an $n \times m$ matrix (the first and last rows, the first and last columns) with $1$ and the rest with $0$, then print the matrix.

A frame matrix: the border cells are ones

Input

One line with two positive integers: $n$ and $m$.

Output

$n$ lines with $m$ space-separated integers each.

Note

$1 \le n, m \le 200$

Examples

Input #1
3 4
Output #1
1 1 1 1
1 0 0 1
1 1 1 1
Input #2
1 1
Output #2
1

Sign in to submit a solution

Signing up is free and takes a minute.