import itertools,sys

def I(): return int(sys.stdin.readline().rstrip())

def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))

N = I()

abc = [LI() for _ in range(N)]

dp = [[0,0,0] for _ in range(N)]

dp[0] = abc[0]

for i,j,k in itertools.product(list(range(N)),[0,1,2],[0,1,2]):

    if j==k:

        continue

    if i-1>=0:

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

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

import itertools,sys

def I(): return int(sys.stdin.readline().rstrip())

def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))

N = I()

abc = [LI() for _ in range(N)]

dp = [[0,0,0] for _ in range(N)]

dp[0] = abc[0]

for i,j,k in itertools.product(list(range(1,N)),[0,1,2],[0,1,2]):

    if j==k:

        continue

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

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

import itertools, sys


def I():
    return int(sys.stdin.readline().rstrip())


def LI():
    return list(map(int, sys.stdin.readline().rstrip().split()))


N = I()
abc = [LI() for _ in range(N)]
dp = [[0, 0, 0] for _ in range(N)]
dp[0] = abc[0]
for i, j, k in itertools.product(list(range(N)), [0, 1, 2], [0, 1, 2]):
    if j == k:
        continue
    if i - 1 >= 0:
        dp[i][j] = max(dp[i][j], dp[i - 1][k] + abc[i][j])
print((max(dp[-1])))

import itertools, sys


def I():
    return int(sys.stdin.readline().rstrip())


def LI():
    return list(map(int, sys.stdin.readline().rstrip().split()))


N = I()
abc = [LI() for _ in range(N)]
dp = [[0, 0, 0] for _ in range(N)]
dp[0] = abc[0]
for i, j, k in itertools.product(list(range(1, N)), [0, 1, 2], [0, 1, 2]):
    if j == k:
        continue
    dp[i][j] = max(dp[i][j], dp[i - 1][k] + abc[i][j])
print((max(dp[-1])))

-for i, j, k in itertools.product(list(range(N)), [0, 1, 2], [0, 1, 2]): +for i, j, k in itertools.product(list(range(1, N)), [0, 1, 2], [0, 1, 2]): -    if i - 1 >= 0: -        dp[i][j] = max(dp[i][j], dp[i - 1][k] + abc[i][j]) +    dp[i][j] = max(dp[i][j], dp[i - 1][k] + abc[i][j])