N = int(eval(input()))



A, B, C = 0, 0, 0

for _ in range(N):

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

    A, B, C = max(B, C) + a, max(C, A) + b, max(A, B) + c

ans = max(A, B, C)



print(ans)
import sys

input=sys.stdin.readline





def solve():

  N = int(eval(input()))



  A, B, C = 0, 0, 0

  for _ in range(N):

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

      A, B, C = max(B, C) + a, max(C, A) + b, max(A, B) + c

  return max(A, B, C)

 

if __name__ == "__main__":

	print((solve()))
N = int(eval(input()))
A, B, C = 0, 0, 0
for _ in range(N):
    a, b, c = list(map(int, input().split()))
    A, B, C = max(B, C) + a, max(C, A) + b, max(A, B) + c
ans = max(A, B, C)
print(ans)

import sys

input = sys.stdin.readline


def solve():
    N = int(eval(input()))
    A, B, C = 0, 0, 0
    for _ in range(N):
        a, b, c = list(map(int, input().split()))
        A, B, C = max(B, C) + a, max(C, A) + b, max(A, B) + c
    return max(A, B, C)


if __name__ == "__main__":
    print((solve()))

-N = int(eval(input())) -A, B, C = 0, 0, 0 -for _ in range(N): -    a, b, c = list(map(int, input().split())) -    A, B, C = max(B, C) + a, max(C, A) + b, max(A, B) + c -ans = max(A, B, C) -print(ans) +import sys + +input = sys.stdin.readline + + +def solve(): +    N = int(eval(input())) +    A, B, C = 0, 0, 0 +    for _ in range(N): +        a, b, c = list(map(int, input().split())) +        A, B, C = max(B, C) + a, max(C, A) + b, max(A, B) + c +    return max(A, B, C) + + +if __name__ == "__main__": +    print((solve()))