// Slower C++ solution:
/*

██╗  ██╗ █████╗ ██████╗ ███████╗███████╗███╗   ███╗        ██╗  ██╗██╗  ██╗ █████╗ ██╗     ███████╗██████╗

██║ ██╔╝██╔══██╗██╔══██╗██╔════╝██╔════╝████╗ ████║        ██║ ██╔╝██║  ██║██╔══██╗██║     ██╔════╝██╔══██╗

█████╔╝ ███████║██████╔╝█████╗  █████╗  ██╔████╔██║        █████╔╝ ███████║███████║██║     █████╗  ██║  ██║

██╔═██╗ ██╔══██║██╔══██╗██╔══╝  ██╔══╝  ██║╚██╔╝██║        ██╔═██╗ ██╔══██║██╔══██║██║     ██╔══╝  ██║  ██║

██║  ██╗██║  ██║██║  ██║███████╗███████╗██║ ╚═╝ ██║███████╗██║  ██╗██║  ██║██║  ██║███████╗███████╗██████╔╝

╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═╝     ╚═╝╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═════╝

Believe in yourself ,( try and try and then try ), You can do it 

*/

#define _CRT_SECURE_NO_WARNINGS

#include<bits/stdc++.h>

#include<unordered_map>

#define endl "\n"

#define Ceil(x,y) ((x+y-1)/y)

#define clr(arr, x) memset(arr, x, sizeof arr)

#define all(v) v.begin(),v.end()

#define allr(s) s.rbegin(),s.rend()

#define rt(s) return cout<<s,0

#define watch(x) cout<<(#x)<<" = "<<x<<endl

#define sz(s)	(int)(s.size())

#define OO 0x3f3f3f3f3f3f3f3fLL

const int oo = 0x3f3f3f3f, mod = 1e9 + 7;

using namespace std;

typedef long long ll;

typedef long double ld;

typedef unsigned long long ull;

//x = xDegrees*3.14159265 / 180;

//ef1tn=(( (n / 2)*( (n / 2) + 1) / 2) * 2);

//of1tn=(n * (n + 1) / 2 - 2 * ((n / 2) * (n / 2 + 1) / 2));

int dx[] { 1, -1, 0, 0, 1, 1, -1, -1 };

int dy[] { 0, 0, 1, -1, 1, -1, 1, -1 };

void K_K(){

#ifndef ONLINE_JUDGE

//	freopen("in.txt", "r", stdin);

//	freopen("out.txt", "w", stdout);

#endif  !ONLINEJUDGE

	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

}

ll gcd(ll a, ll b) {

	return b == 0 ? abs(a) : gcd(b, a % b);

}

ll lcm(ll a, ll b) {

	return a / gcd(a, b) * b;

}

int n;

vector<int>a, b, c;

int dp[100005][5];

int sol(int idx, int pre){

	if (idx == n)

		return 0;

	int& ret = dp[idx][pre];

	if (~ret)

		return ret;

	int ch1 = 0, ch2 = 0, ch3 = 0;

	if (pre != 1)

		ch1 = sol(idx + 1, 1) + a[idx];

	if (pre != 2)

		ch2 = sol(idx + 1, 2) + b[idx];

	if (pre != 3)

		ch3 = sol(idx + 1, 3) + c[idx];

	return ret = max({ ch1, ch2, ch3 });

}

int main(){

	K_K();

	cin >> n;

	a.resize(n);

	b.resize(n);

	c.resize(n);

	clr(dp, -1);

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

		cin >> a[i] >> b[i] >> c[i];

	cout << sol(0, 0);

}

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

using namespace std;

typedef long long ll;

typedef unsigned long long ull;

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

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

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

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

#define     lp(i,a,b)       for(int i=a;i<b;i++)

#define     Endl            "\n";

#define     tab             "\t"

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

#define     sf(a)           scanf(" %d", &a);

#define     srt(a)          sort(a.begin(),a.end());

#define     pi              2*acos(0.0)

#define     inf             INT_MAX

const int sz=1e5+9;

int n,x,arr[sz][3],dp[sz][3];



int clac(int i,int ignore ,int value){

    if(i>n)return value;

    if(dp[i][ignore]!=-1)return dp[i][ignore];

    int ret=0;

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

        if(j==ignore)

            continue;

        ret=max(ret,value+clac(i+1,j,arr[i][j]));

    }

    return dp[i][ignore]=ret;

}



void solve(){

    cin>>n;

    reset(dp,-1);

    //cout<<dp[2][0]<<tab<<dp[2][1]<<tab<<dp[2][2]<<endl;

    lp(i,1,n+1)cin>>arr[i][0]>>arr[i][1]>>arr[i][2];

    int ans1=clac(2,0,arr[1][0]);

    //cout<<dp[2][0]<<tab<<dp[2][1]<<tab<<dp[2][2]<<endl;

    int ans2=clac(2,1,arr[1][1]);

    int ans3=clac(2,2,arr[1][2]);

    //cout<<ans1<<tab<<ans2<<tab<<ans3<<endl;

    //int ans=max(ans1,(max(ans2,ans3)));

   // bug(ans1,1);

    cout<<max(ans1,(max(ans2,ans3)))<<"\n";

}



int main(){

    //FasterIO;

    #ifndef ONLINE_JUDGE

       //freopen("1.txt","r",stdin);

    #endif

    // int t;

    //cin>>t;

    //while(t--)

        solve();

}