CodeLab Academy 📞 9936 6696
← List Python · Level 8: Nested loops Code · 80 points ← #747 #749 →

#748. Matrix: Sum of the upper triangle (with the diagonal)

You are given a matrix of integers. **Sum of the upper triangle (with the diagonal)**. ### Input The first line has n n, each of the next n lines has n integers (a square matrix). ### Output The answer.

Examples

Input
3 3
-5 -5 0
2 5 1
-9 0 -5
Output
-9
Input
2 2
3 5
-6 5
Output
13

💡 You can solve it with Python, JavaScript or blocks. Read the input line by line with input(). Don't print a question (like input("Number: ")). Print exactly what the output asks for, nothing more.

🔒 You can solve the first 3 problems without an account. Sign up for free to solve this one!