import sys

input = sys.stdin.readline

N = int(eval(input()))

ABC = [list(map(int,input().split())) for i in range(N)]



dp = [[0]*3 for i in range(N+1)]



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

    dp[i] = [max([dp[i-1][k]+ABC[i-1][j] for k in range(3) if j != k]) for j in range(3)]



print((max(dp[N])))
import sys

input = sys.stdin.readline

N = int(eval(input()))

ABC = [list(map(int,input().split())) for i in range(N)]



dp = [0]*(N+1)

dp[0] = [0,0,0]



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

    dp[i] = [max([dp[i-1][k]+ABC[i-1][j] for k in range(3) if j != k]) for j in range(3)]



print((max(dp[N])))
import sys

input = sys.stdin.readline
N = int(eval(input()))
ABC = [list(map(int, input().split())) for i in range(N)]
dp = [[0] * 3 for i in range(N + 1)]
for i in range(1, N + 1):
    dp[i] = [
        max([dp[i - 1][k] + ABC[i - 1][j] for k in range(3) if j != k])
        for j in range(3)
    ]
print((max(dp[N])))

import sys

input = sys.stdin.readline
N = int(eval(input()))
ABC = [list(map(int, input().split())) for i in range(N)]
dp = [0] * (N + 1)
dp[0] = [0, 0, 0]
for i in range(1, N + 1):
    dp[i] = [
        max([dp[i - 1][k] + ABC[i - 1][j] for k in range(3) if j != k])
        for j in range(3)
    ]
print((max(dp[N])))

-dp = [[0] * 3 for i in range(N + 1)] +dp = [0] * (N + 1) +dp[0] = [0, 0, 0]