using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

class C {
    static StreamWriter Out = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
    static void Main(string[] args) {
        int N;
        Input(out N);
        int[,] max = new int[N + 1, 3];
        max[0, 0] = 0;
        max[0, 1] = 0;
        max[0, 2] = 0;
        for(int i = 1; i <= N; i++) {
            int a, b, c;
            Input(out a, out b, out c);
            int _max0 = 0;
            int _max1 = 0;
            int _max2 = 0;
            for(int j = 0; j < 3; j++) {
                switch(j) {
                case 0:
                    UpdateMax(ref _max0, a + max[i - 1, 1]);
                    UpdateMax(ref _max0, a + max[i - 1, 2]);
                    break;
                case 1:
                    UpdateMax(ref _max1, b + max[i - 1, 0]);
                    UpdateMax(ref _max1, b + max[i - 1, 2]);
                    break;
                case 2:
                    UpdateMax(ref _max2, c + max[i - 1, 0]);
                    UpdateMax(ref _max2, c + max[i - 1, 1]);
                    break;
                }
            }
            max[i, 0] = _max0;
            max[i, 1] = _max1;
            max[i, 2] = _max2;
        }
        /*
        for(int i = 0; i <= N; i++) {
            Print($"[{max[i, 0]} {max[i, 1]} {max[i, 2]}]");
        }
        */
        int _max = 0;
        UpdateMax(ref _max, max[N, 0]);
        UpdateMax(ref _max, max[N, 1]);
        UpdateMax(ref _max, max[N, 2]);
        Print(_max);
        Out.Flush();
    }
    static void UpdateMax(ref int _old, int _new) {
        if(_old < _new) {
            _old = _new;
        }
    }
    static T ChangeT<T>(string s) => (T)Convert.ChangeType(s, typeof(T));
    static void Input<A>(out A a) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
    }
    static void Input<A, B>(out A a, out B b) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
    }
    static void Input<A, B, C>(out A a, out B b, out C c) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
    }
    static void Input<A, B, C, D>(out A a, out B b, out C c, out D d) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
    }
    static void Input<A, B, C, D, E>(out A a, out B b, out C c, out D d, out E e) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
    }
    static void Input<A, B, C, D, E, F>(out A a, out B b, out C c, out D d, out E e, out F f) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
        f = ChangeT<F>(words[5]);
    }
    static void InputArray<T>(out T[] array) {
        array = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries).Select(s => ChangeT<T>(s)).ToArray();
    }
    static void Print<T>(T s) => Out.WriteLine(s);
    static void Print<T>(params T[] s) => Out.WriteLine(string.Join(" ", s));
    static void Print<T>(IEnumerable<T> e) => Out.WriteLine(string.Join(" ", e));
}

Measured memory_bytes: 17436