#import

#import math

#import numpy as np

N = int(eval(input()))

#= input()

#= map(int, input().split())

#= list(map(int, input().split()))

#= [input(), input()]



a = []



# dp[i][0]:Aを選んだ  dp[i][1]:Bを選んだ  dp[i][2]:Cを選んだ 



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



for _ in range(N):

    aa = list(map(int, input().split()))

    a.append(aa)



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

    for j in range(3):

        for k in range(3):

            if j != k:

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



print((max(dp[-1])))
#!/usr/bin/env python3



#import

#import math

#import numpy as np

N = int(eval(input()))

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



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



for i in range(N):

    if i == 0:

        dp[i][0] = abc[i][0]

        dp[i][1] = abc[i][1]

        dp[i][2] = abc[i][2]

        continue



    for j in range(3):

        for k in range(3):

            if j != k:

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







print((max(dp[-1])))
# import
# import math
# import numpy as np
N = int(eval(input()))
# = input()
# = map(int, input().split())
# = list(map(int, input().split()))
# = [input(), input()]
a = []
# dp[i][0]:Aを選んだ  dp[i][1]:Bを選んだ  dp[i][2]:Cを選んだ
dp = [[0] * 3 for _ in range(N + 1)]
for _ in range(N):
    aa = list(map(int, input().split()))
    a.append(aa)
for i in range(1, N + 1):
    for j in range(3):
        for k in range(3):
            if j != k:
                dp[i][k] = max(dp[i][k], dp[i - 1][j] + a[i - 1][k])
print((max(dp[-1])))

#!/usr/bin/env python3
# import
# import math
# import numpy as np
N = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(N)]
dp = [[0] * 3 for _ in range(N)]
for i in range(N):
    if i == 0:
        dp[i][0] = abc[i][0]
        dp[i][1] = abc[i][1]
        dp[i][2] = abc[i][2]
        continue
    for j in range(3):
        for k in range(3):
            if j != k:
                dp[i][j] = max(dp[i][j], dp[i - 1][k] + abc[i][j])
print((max(dp[-1])))

+#!/usr/bin/env python3 -# = input() -# = map(int, input().split()) -# = list(map(int, input().split())) -# = [input(), input()] -a = [] -# dp[i][0]:Aを選んだ  dp[i][1]:Bを選んだ  dp[i][2]:Cを選んだ -dp = [[0] * 3 for _ in range(N + 1)] -for _ in range(N): -    aa = list(map(int, input().split())) -    a.append(aa) -for i in range(1, N + 1): +abc = [list(map(int, input().split())) for _ in range(N)] +dp = [[0] * 3 for _ in range(N)] +for i in range(N): +    if i == 0: +        dp[i][0] = abc[i][0] +        dp[i][1] = abc[i][1] +        dp[i][2] = abc[i][2] +        continue -                dp[i][k] = max(dp[i][k], dp[i - 1][j] + a[i - 1][k]) +                dp[i][j] = max(dp[i][j], dp[i - 1][k] + abc[i][j])