Module Module1

    Sub Main()

        Dim n As Integer
        n = Console.ReadLine
        Dim a(1, n - 1) As Integer
        Dim b, c, f As String
        For j As Integer = 0 To 1
            Dim d As Integer = 1
            Dim e As Integer = 0
            b = Console.ReadLine
            For i = 1 To Len(b)
                If Mid(b, i, 1) = " " Then
                    a(j, e) = Val(Mid(b, d, (i - d)))
                    d = i + 1
                    e = e + 1

                End If

            Next
            a(j, e) = Val(Right(b, Len(b) - d + 1))
        Next
        Dim n1, n2, sum, lsum As Integer
        'sum is the sum of the selected rows and columns 
        'lsum is the largest sum of the sum 

        For i As Integer = 0 To (n - 1)
            For j As Integer = 0 To n
                sum = sum + a(n1, n2)
                If sum > lsum Then
                    lsum = sum
                End If
                If i = j Then
                    n1 = n1 + 1
                Else
                    n2 = n2 + 1
                End If

            Next
            n1 = 0
            n2 = 0
            sum = 0

        Next
        Console.WriteLine(lsum)
        Console.ReadLine()

    End Sub

End Module
