Solution
3 3 1 1 5
3 4 1 1 5
3 4 4 4 5
2 2 2 2 5