# coding: utf-8



import sys

input = sys.stdin.readline



def f(n, abc):

    dp = [[0] * 3 for _ in range(n + 1)]

    for i in range(1, n + 1):

        for j in range(3):

            dp[i][j] = max(dp[i - 1][k] + abc[i - 1][j] \

                for k in range(3) if k != j)

    return(max(dp[n]))



n = int(eval(input()))    # 1 <= n <= 10^5

abc = [list(map(int, input().rstrip().split())) for _ in range(n)]



print((f(n, abc)))

# coding: utf-8

import sys

input = sys.stdin.readline



def f(n, abc):

    dp = [0] * 3

    for i in range(1, n + 1):

        a, b, c = abc[i - 1]

        dp = [ max(dp[1] + a, dp[2] + a), \

               max(dp[0] + b, dp[2] + b), \

               max(dp[0] + c, dp[1] + c) ]

    return(max(dp))



n = int(eval(input()))    # 1 <= n <= 10^5

abc = [list(map(int, input().rstrip().split())) for _ in range(n)]



print((f(n, abc)))

# coding: utf-8
import sys

input = sys.stdin.readline


def f(n, abc):
    dp = [[0] * 3 for _ in range(n + 1)]
    for i in range(1, n + 1):
        for j in range(3):
            dp[i][j] = max(dp[i - 1][k] + abc[i - 1][j] for k in range(3) if k != j)
    return max(dp[n])


n = int(eval(input()))  # 1 <= n <= 10^5
abc = [list(map(int, input().rstrip().split())) for _ in range(n)]
print((f(n, abc)))

# coding: utf-8
import sys

input = sys.stdin.readline


def f(n, abc):
    dp = [0] * 3
    for i in range(1, n + 1):
        a, b, c = abc[i - 1]
        dp = [
            max(dp[1] + a, dp[2] + a),
            max(dp[0] + b, dp[2] + b),
            max(dp[0] + c, dp[1] + c),
        ]
    return max(dp)


n = int(eval(input()))  # 1 <= n <= 10^5
abc = [list(map(int, input().rstrip().split())) for _ in range(n)]
print((f(n, abc)))

-    dp = [[0] * 3 for _ in range(n + 1)] +    dp = [0] * 3 -        for j in range(3): -            dp[i][j] = max(dp[i - 1][k] + abc[i - 1][j] for k in range(3) if k != j) -    return max(dp[n]) +        a, b, c = abc[i - 1] +        dp = [ +            max(dp[1] + a, dp[2] + a), +            max(dp[0] + b, dp[2] + b), +            max(dp[0] + c, dp[1] + c), +        ] +    return max(dp)