import java.math.*;
import java.util.*; import java.io.*;
/*
 * untitled.java
 * Copyright 2019 Karan Kanojia <karankanojia@Karans-MacBook-Air.local>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 */

public class Main implements Runnable{

    static DusroKiBike scan = new DusroKiBike(System.in);
    static Scanner scanner = new Scanner(System.in);
    static StringBuffer stringBuffer = new StringBuffer();
    static PrintWriter out  = new PrintWriter(System.out);
    static int MAX = 1111111111;
    static int bit_max = 32;
    static int ALPHA_LIMIT = 30;
    static int  SQRT_BUCKET = 555;
    static int lim = 1000000007;
    static long watcher = 0;
    static void inputL(int n, long[] arr) {
        for(int i=0; i<n; i++){
            arr[i] = scan.nextLong();
        }
    }
    static void inputI(int n, int[] arr) {
        for(int i=0; i<n; i++){
            arr[i] = scan.nextInt();
        }
    }
    static int upper_bound(int left, int right, long[] arr, long key){
        if(left == right){
            if(arr[left] >= key){
                return left;
            }
            return -202;
        }else if(right-left == 1){
            if(arr[left] >= key){
                return left;
            }
            if(arr[right] >= key){
                return right;
            }
            return -202;
        }else{
            int mid = (left+right)/2;
            if(arr[mid] >= key){
                return upper_bound(left, mid, arr, key);
            }else{
                return upper_bound(mid+1, right, arr, key);
            }
        }
    }
    static int lower_bound(int left, int right, long[] arr, long key){
        if(left == right){
            if(arr[left] <= key){
                return left;
            }
            return -202;
        }else if(right-left == 1){
            if(arr[right] <= key){
                return right;
            }
            if(arr[left] <= key){
                return left;
            }
            return -202;
        }else{
            int mid = (left+right)/2;
            if(arr[mid] <= key){
                return lower_bound(mid, right, arr, key);
            }else{
                return lower_bound(left, mid-1, arr, key);
            }
        }
    }


    static long[] tree;
    static void update(int left, int right, int index, int ql, int qr, long val){
        if(left<=ql && right>=qr){
            tree[index] = val;
        }else if(right < ql || left > qr){
            return;
        }else{
            int mid = (left+right)/2;
            update(left,mid,2*index, ql,qr, val);
            update(mid+1, right, 2*index+1, ql,qr, val );
            tree[index] = Long.min(tree[2*index], tree[2*index+1]);
            return;
        }
    }
    static long query(int left, int right, int index, int ql, int qr){
        if(left <=ql && right>=qr){
            return tree[index];
        }else if(right < ql || left > qr){
            return Long.MAX_VALUE;
        }else{
            int mid = (left+right)/2;
            long a = query(left, mid, 2*index, ql,qr);
            long b = query(mid+1, right, 2*index+1, ql,qr);
            return Long.min(a,b);
        }
    }


    @Override
    public void run() {

        int t = 1;
        while(t-->0){
            int n = scan.nextInt();
            long[][] arr = new long[n][3];
            for(int i=0; i<n; i++){
                inputL(3,arr[i]);
            }
            long[][] dp = new long[n][3];
            dp[n-1][0] = arr[n-1][0];
            dp[n-1][1] = arr[n-1][1];
            dp[n-1][2] = arr[n-1][2];
            for(int i=n-2; i>=0; i--){
                dp[i][0] = arr[i][0]+Long.max(dp[i+1][1], dp[i+1][2]);
                dp[i][1] = arr[i][1]+Long.max(dp[i+1][0], dp[i+1][2]);
                dp[i][2] = arr[i][2]+Long.max(dp[i+1][0], dp[i+1][1]);
            }
            long answer = Long.max(dp[0][0], Long.max(dp[0][1], dp[0][2]));
            out.println(answer);
        }

        out.close();
    }

    public static void main(String[] args) {
        new Thread(null, new Main(), "Main", 1<<26).start();
    }


    static class DusroKiBike {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public DusroKiBike(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }


}

Measured memory_bytes: 32980