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

using namespace std;

typedef long long ll;

typedef unsigned long long ull;

const int N = 1e5+10 , OO = 0x3f3f3f3f ;

//const int mod = 1000000007;

 

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

double startTime;

double getCurrentTime() {

	return ((double)clock() - startTime) / CLOCKS_PER_SEC;

}

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

#define loop(i,n) for(int i = 0;i < int(n);i++)

#define rloop(i,n) for(int i = int(n)-1;i >= 0;i--)

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

#define range(vec) for(auto &x : vec) cin >> x;

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

#define SZ(v)  ((int)((v).size()))

int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction

//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction

//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction

//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

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

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



int a[N] , b[N] , c[N] , n;

int dp[N][4];



int solve(int idx , int lst){

	

	if(idx == n) return 0;

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

	if(~ret) return ret;

	ret = -OO;

	if(lst != 0) // swim

		ret = max(ret , solve(idx+1 , 0) + a[idx]);

	if(lst != 1)

		ret = max(ret , solve(idx+1 , 1) + b[idx]);

	if(lst != 2)

		ret = max(ret , solve(idx+1 , 2) + c[idx]);

		

	return ret;

}





int main()

{

    startTime = (double)clock();

    #ifndef ONLINE_JUDGE

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

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

    #endif

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

	

	cin >> n;

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

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



	clr(dp , -1);

	cout << solve(0 , 3) << "\n";





    return 0;

}

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

using namespace std;

using ll = long long;

using ii = pair<int, int>;

using iii = pair<ii, int>;

#define vt vector

#define pq priority_queue

#define pb push_back

#define pf push_front

#define mp make_pair

#define fi first

#define se second

#define __lcm(a, b) a * b / __gcd(a, b)

const int MOD = 1e9 + 7;

const int INF = 2e9;

const int N = 1e5 + 5;



int n;

int a[N], b[N], c[N];

int dp[N][5];



void getDP() {

    // i = index, j = now

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

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

            int &sol = dp[i][j];

            if(j == 0) 

                sol = max(dp[i - 1][1] + a[i - 1],

                      max(dp[i - 1][2] + b[i - 1],

                          dp[i - 1][3] + c[i - 1]));

            else if(j == 1) 

                sol = max(dp[i - 1][2] + b[i - 1],

                          dp[i - 1][3] + c[i - 1]);

            else if(j == 2) 

                sol = max(dp[i - 1][1] + a[i - 1],

                          dp[i - 1][3] + c[i - 1]);

            else 

                sol = max(dp[i - 1][1] + a[i - 1],

                          dp[i - 1][2] + b[i - 1]);

        }

    }

}



void solve() {

    cin >> n;

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

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

    }

    getDP();

    cout << max(dp[n][1] + a[n], max(dp[n][2] + b[n], dp[n][3] + c[n])) << "\n";

}



int main() {

 

    ios_base::sync_with_stdio(0);

    cin.tie(0); cout.tie(0);

    

    solve();

    

}