task6: logic finished & output needed
matrix: fix in sum routine