// Slower C++ solution:
#include <bits/stdc++.h>





using namespace std;



vector<vector<int>> vec(100007);

int n;



long long meme[100007][5];





long long solve(int index, int flag){

    if(index==n){

        return 0;

    }

    

    long long &res = meme[index][flag]; 

    

    if(res != -1){

        return res;

    }

    res = 0;

    

    if(flag!=0){

        res = max(res,vec[index][0]+solve(index+1,0));

    }

    if(flag!=1){

        res =  max(res,vec[index][1]+solve(index+1,1));

    }

    if(flag!=2){

        res =  max(res,vec[index][2]+solve(index+1,2));

    }

    return res;

}



int main(){

    cin>>n;

    int num1,num2,num3;

    memset(meme,-1,sizeof(meme));

    for(int i = 0 ; i<n ; i++){

        cin>>num1>>num2>>num3;

        vec[i].push_back(num1);

        vec[i].push_back(num2);

        vec[i].push_back(num3);

    }

    long long sol = solve(0,3);

    cout<<sol<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 7.882148982589885x):
#include <bits/stdc++.h>

using namespace std;



typedef long double LD;

typedef long long ll;

typedef map<int,int> mii;

typedef pair<int,int> pii;

typedef vector<pii> vpii;



#define pb              push_back

#define mp              make_pair

#define F               first

#define S               second

#define mod             1000000007

#define INF             2147483647

#define endl            "\n"

#define FasterIO        ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0) ;

#define precision(a)    cout << fixed << setprecision(a)

#define bug(a,b)        cout<<a<<"\t"<<b<<"\n";

#define Case(a,b)       cout<<"Case "<<a<<": "<<b<<"\n";

#define reset(a,b)      memset(a,b,sizeof(a));

#define For(x,n)        for(int i=x; i<n; i++)



const int MAXN = 1000005;

const int SQRTN = 1003;

const int LOGN = 22;

const double PI=acos(-1);



int strtoint(string str){

    stringstream ss(str);

    int x = 0;

    ss >> x ;

    return x ;

}

string intostr(int x){

    stringstream ss;

    ss << x;

    string str = ss.str();

    return str;

}

void rem(string &s, const string &c) {

	auto pos = s.find(c);

	if (pos == string::npos) {

		cout << -1 << endl;

		exit(0);

	}

	s.erase(0, pos + 1);

}

void println (int n){

    cout<<n<<"\n";

}

void printvec(vector <int> &a){

    for (int i=0;i<a.size();i++){

        cout<<a[i]<<" ";

    }

    cout<<"\n";

}



void printgraph(vector <int> g[],int e){

    for (int i=0;i<e;i++){

        cout<<i<<" --> ";

        for (int j=0;j<g[i].size();j++){

            cout<<g[i][j]<<" ";

        }

        cout<<"\n";

    }

}



void printmap (map <int,int> &mymap){

    for (auto itr = mymap.begin(); itr != mymap.end(); ++itr) {

        cout << '\t' << itr->first

             << '\t' << itr->second << '\n';

    }

    cout << "\n";

}







void solve(){

    int n;

    cin>>n;

    int v[n+1][3];



    for (int i=0;i<n;i++){

        for (int j=0;j<3;j++){

            cin>>v[i][j];

        }

    }



    int temp[n][3];

    temp[0][0] = v[0][0];

    temp[0][1] = v[0][1];

    temp[0][2] = v[0][2];

    for (int i=1;i<n;i++){



        temp[i][0] = v[i][0] + max(temp[i - 1][1], temp[i - 1][2]);

        temp[i][1] = v[i][1] + max(temp[i - 1][0], temp[i - 1][2]);

        temp[i][2] = v[i][2] + max(temp[i - 1][1], temp[i - 1][0]);





        /*for (int x=0;x<n;x++){

            for (int y=0;y<3;y++){

                cout<<temp[x][y]<<" ";

            }

            cout<<endl;

        }*/







    }





    cout << max({temp[n - 1][0], temp[n - 1][1], temp[n - 1][2]});





}





int main(){

    //FasterIO;



    solve();

    return 0;

}