import sys

import numpy as np

n = int(eval(input()))



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



for i in range(n-1):

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

    dp0, dp1, dp2 = dp

    dp[0] = max(dp1+a,dp2+a)

    dp[1] = max(dp0+b,dp2+b)

    dp[2] = max(dp0+c,dp1+c)

print((max(dp)))
import sys

import numpy as np

n = int(eval(input()))



dp = list(map(int, sys.stdin.readline().split()))



for i in range(n-1):

    a, b, c = list(map(int, sys.stdin.readline().split()))

    dp0, dp1, dp2 = dp

    dp[0] = max(dp1+a,dp2+a)

    dp[1] = max(dp0+b,dp2+b)

    dp[2] = max(dp0+c,dp1+c)

print((max(dp)))
import sys
import numpy as np

n = int(eval(input()))
dp = list(map(int, input().split()))
for i in range(n - 1):
    a, b, c = list(map(int, input().split()))
    dp0, dp1, dp2 = dp
    dp[0] = max(dp1 + a, dp2 + a)
    dp[1] = max(dp0 + b, dp2 + b)
    dp[2] = max(dp0 + c, dp1 + c)
print((max(dp)))

import sys
import numpy as np

n = int(eval(input()))
dp = list(map(int, sys.stdin.readline().split()))
for i in range(n - 1):
    a, b, c = list(map(int, sys.stdin.readline().split()))
    dp0, dp1, dp2 = dp
    dp[0] = max(dp1 + a, dp2 + a)
    dp[1] = max(dp0 + b, dp2 + b)
    dp[2] = max(dp0 + c, dp1 + c)
print((max(dp)))

-dp = list(map(int, input().split())) +dp = list(map(int, sys.stdin.readline().split())) -    a, b, c = list(map(int, input().split())) +    a, b, c = list(map(int, sys.stdin.readline().split()))