def main():

  n = int(eval(input()))

  a = [0]

  b = [0]

  c = [0]



  for i in range(n):

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

      a.append(max(b[i] + aa, c[i] + aa))

      b.append(max(a[i] + bb, c[i] + bb))

      c.append(max(a[i] + cc, b[i] + cc))



  print((max(a[-1], b[-1], c[-1])))



main()
def main():

    n = int(eval(input()))

    a = 0

    b = 0

    c = 0



    for i in range(n):

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

        a,b,c = max(b,c)+aa, max(a,c)+bb, max(a,b)+cc



    print((max(a,b,c)))



main()

def main():
    n = int(eval(input()))
    a = [0]
    b = [0]
    c = [0]
    for i in range(n):
        aa, bb, cc = list(map(int, input().split()))
        a.append(max(b[i] + aa, c[i] + aa))
        b.append(max(a[i] + bb, c[i] + bb))
        c.append(max(a[i] + cc, b[i] + cc))
    print((max(a[-1], b[-1], c[-1])))


main()

def main():
    n = int(eval(input()))
    a = 0
    b = 0
    c = 0
    for i in range(n):
        aa, bb, cc = list(map(int, input().split()))
        a, b, c = max(b, c) + aa, max(a, c) + bb, max(a, b) + cc
    print((max(a, b, c)))


main()

-    a = [0] -    b = [0] -    c = [0] +    a = 0 +    b = 0 +    c = 0 -        a.append(max(b[i] + aa, c[i] + aa)) -        b.append(max(a[i] + bb, c[i] + bb)) -        c.append(max(a[i] + cc, b[i] + cc)) -    print((max(a[-1], b[-1], c[-1]))) +        a, b, c = max(b, c) + aa, max(a, c) + bb, max(a, b) + cc +    print((max(a, b, c)))