output_description: For each dataset, print the table with sums of rows and columns. Each item of
  the table should be aligned to the right with a margin for five digits. Please
  see the sample output for details.
input_description: The input consists of several datasets. Each dataset consists of:
  
      
      
      _n_ (the size of row and column of the given table)
      1st row of the table
      2nd row of the table
       :
       :
      _n_ th row of the table
      
  
  The input ends with a line consisting of a single 0.
attempt: if __name__ == "__main__":
  
      while True:
  
          n = int(input())
  
          if n == 0:
              break
  
          A = [[0 for _ in range(n + 1)] for _ in range(n)]
          B = [0 for _ in range(n + 1)]
  
          for i in range(n):
              tmp = list(map(int, input().split()))
  
              for j, k in enumerate(tmp):
                  A[i][j] += k
                  B[j] += k
  
              A[i][n] = sum(A[i])
              B[n] = sum(B[:n])
  
          for m in A:
              tmp2 = ""
              for g in m:
                  tmp2 += "{:>5}".format(str(g))
              print(tmp2)
          tmp3 = ""
          for y in B:
              tmp3 += "{:>5}".format(str(y))
          print(tmp3)
  
problem_description: Matrix-like Computation
  
  Your task is to develop a tiny little part of spreadsheet software.
  
  Write a program which adds up columns and rows of given table as shown in the
  following figure:
  
  ![](https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike)
samples: [{"input": "52 96 15 20\n    86 22 35 45\n    45 78 54 36\n    16 86 74 55\n    4\n    52 96 15 20\n    86 22 35 45\n    45 78 54 36\n    16 86 74 55\n    0", "output": "96   15   20  183\n       86   22   35   45  188\n       45   78   54   36  213\n       16   86   74   55  231\n      199  282  178  156  815\n       52   96   15   20  183\n       86   22   35   45  188\n       45   78   54   36  213\n       16   86   74   55  231\n      199  282  178  156  815"}]