def vacation():

    n = int(eval(input()))

    dp = [[]]*n

    for i in range(n):

        a, b, c = list(map(int, input().split()))

        if i == 0:

            dp[i] = [a, b, c]

        else:

            dp[i] = [a + max(dp[i-1][1], dp[i-1][2]), b + max(dp[i-1][0], dp[i-1][2]), c + max(dp[i-1][0], dp[i-1][1])]

    print((max(dp[-1])))





if __name__ == '__main__':

    vacation()

import sys

input = sys.stdin.readline





def vacation():

    n = int(eval(input()))

    dp = [[]]*n

    for i in range(n):

        a, b, c = list(map(int, input().split()))

        if i == 0:

            dp[i] = [a, b, c]

        else:

            dp[i] = [a + max(dp[i-1][1], dp[i-1][2]), b + max(dp[i-1][0], dp[i-1][2]), c + max(dp[i-1][0], dp[i-1][1])]

    print((max(dp[-1])))





if __name__ == '__main__':

    vacation()

def vacation():
    n = int(eval(input()))
    dp = [[]] * n
    for i in range(n):
        a, b, c = list(map(int, input().split()))
        if i == 0:
            dp[i] = [a, b, c]
        else:
            dp[i] = [
                a + max(dp[i - 1][1], dp[i - 1][2]),
                b + max(dp[i - 1][0], dp[i - 1][2]),
                c + max(dp[i - 1][0], dp[i - 1][1]),
            ]
    print((max(dp[-1])))


if __name__ == "__main__":
    vacation()

import sys

input = sys.stdin.readline


def vacation():
    n = int(eval(input()))
    dp = [[]] * n
    for i in range(n):
        a, b, c = list(map(int, input().split()))
        if i == 0:
            dp[i] = [a, b, c]
        else:
            dp[i] = [
                a + max(dp[i - 1][1], dp[i - 1][2]),
                b + max(dp[i - 1][0], dp[i - 1][2]),
                c + max(dp[i - 1][0], dp[i - 1][1]),
            ]
    print((max(dp[-1])))


if __name__ == "__main__":
    vacation()

+import sys + +input = sys.stdin.readline + +