#include <bits/stdc++.h>

#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,n) for(int i=0;i<(n);++i)
#define repA(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define rep2(j, n) for(int j=0; j<(n); ++j)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define maximum INT_MAX

using namespace std;
using ll = long long;
using ld = long double;
const int mod = 1e9+7;
const long long inf=1e11+5;
bool isPrime(ll n){for(ll i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
ll factorial(ll n){return (n==1 || n==0) ? 1:n*factorial(n-1);}
ll power(ll x,ll y){ll res=1;x=x;while(y>0){if(y&1)res=(res*x);y=y>>1;x=(x*x);}return res;}
ll ncr(ll n,ll r){ll res=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){res*=(n-i);res/=(i+1);}return res;}
ll gcd(ll a,ll b){if (a==0)return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return (a/gcd(a,b)*b);}
ll max(ll a,ll b){ll ans=a>b?a:b;return ans;}
ll min(ll a,ll b){ll ans=a<b?a:b;return ans;}
// void print_set(vector<int> a)
// {
// 	cout<<a.size()<<"\n";
// 	for(auto x: a)
// 	{
// 		cout<<x<<' ';
// 	}
// 	cout<<"\n";
	
// }

void solve()
{
	ll n;
	cin>>n;
	vector<vector<int>> arr;
	vector<int> dp(3, 0);
	for(int k=0; k<n; k++)
	{
		vector<int> cost(3);
		for(int i=0; i<3; i++)
		{
			cin>>cost[i];
		}
		vector<int> new_dp(3, 0);
		for(int i=0; i<3; i++)
		{
			
			for(int j=0; j<3; j++)
			{
				if(i!=j)
				{
					new_dp[j]=max(new_dp[j], dp[i]+cost[j]);
				}
			}
			
		}
		dp=new_dp;
	}
	int ans=max(dp[0], max(dp[1], dp[2]));
	cout<<ans;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;

    
}
/*
void extendEuclid(int A, int B)
{
    if(B==0)
    {
        x=1;
        y=0;
    }
    else
    {
        extendEuclid(B, A%B);
        int temp=x;
        x=y;
        y=temp-(A/B)*y;
    }
}
int modularExponentiation(int X, int n, int M)
{
    int result=1;
    while(n>0)
    {
        if(n%2==1)
        {
            result=(x*result)%M;
        }
        else
        {
            x=x*x%M;
        }
        n=n/2;
        return result;
    }
    
}
int modInv(int A, int M)
{
    extendEuclid(A, M)
    return (x%M+M)%M;
}
int main()
{
    int arr[4];
    std::cin>>arr;
    int A=arr[0], B=arr[1], C=arr[2], M=arr[3];
    int D=modInv(C, M);
    int E=modularExponentiation(A, B, M);
    int ans=(D*E)%M;
    std::cout<<ans;
    
}*/

/*int totalMultiples(int x, int a, int b, int c)
{
	int un=x/a + x/b + x/c;
	int in=x/lcm(a, b) + x/lcm(b, c) + x/lcm(a, c)
	int fin=x/lcm(lcm(a, b), c)
	int result=un-in+fin;
	return result;
}

int binarySearch(vector<int> arr, int n)
{
	int low=0;
	int high=arr.size()-1;

	while(low<high)
	{
		int mid=(high+low)/2;
		
		if(arr[mid]<=n)
		{
			high=mid;
		}
		else
		{
			low=mid+1;
		}

	}
	return low;
}

*/
/* Fast Factorization using Seive */
/*
int minPrime[n + 1];
for (int i = 2; i * i <= n; ++i) {
    if (minPrime[i] == 0) {         //If i is prime
        for (int j = i * i; j <= n; j += i) {
            if (minPrime[j] == 0) {
                minPrime[j] = i;
            }
        }
    }
}
for (int i = 2; i <= n; ++i) {
    if (minPrime[i] == 0) {
        minPrime[i] = i;
    }
}
vector<int> factorize(int n) {
    vector<int> res;
    while (n != 1) {
        res.push_back(minPrime[n]);
        n /= minPrime[n];
    }
    return res;
}
*/

Measured memory_bytes: 256