//Author: rishab_1128

#include<bits/stdc++.h> 
using namespace std;
 
typedef string                         STR;
typedef long long                      ll;
typedef long double                    ld;
typedef unsigned long long             ull;
typedef vector<int>                    vi;
typedef priority_queue<int>            pqi;
typedef vector<ll>                     vll;
typedef vector<ull>                    vull;
typedef vector<STR>                    vs;
typedef vector<char>                   vc;
typedef pair<int,int>                  pii;
typedef pair<ll,ll>                    pll;
typedef pair<STR,int>                  psi;
typedef pair<char,ll>                  pcl;
typedef pair<int,STR>                  pis;
typedef vector<pii>                    vpii;
typedef vector<pll>                    vpll;
typedef vector<pcl>                    vpcl;
typedef map<int,int>                   mii;
typedef map<ll,ll>                     mll;
typedef map<STR,int>                   msi;
typedef map<char,int>                  mci;
typedef map<int,STR>                   mis;
typedef set<STR>                       ss;
typedef set<char>                      sc;
typedef set<int>                       si;
typedef set<ll>                        sll;
 
#define FF                             first
#define SS                             second
#define PB                             push_back
#define PF                             push_front
#define MP                             make_pair
#define all(a)                         (a).begin(), (a).end()
#define ps(x,y)                        fixed<<setprecision(y)<<x
#define setbits(x)                     __builtin_popcountll(x)
#define zrobits(x)                     __builtin_ctzll(x)
#define d2b(x,n)                       bitset<x>(n).to_string()
#define b2d(x,n)                       bitset<x>(n).to_ulong()
#define f(i,a,n)                       for(ll i=a; i<n; i++)                                      
#define f1(i,b,m)                      for(ll i=b; i<=m; i++)
#define f2(i,x,y)                      for(ll i=x; i>=y; i--)
#define fsort(a)                       sort(a.begin(), a.end())
#define rsort(a)                       sort(a.rbegin(), a.rend())
#define w(t)                           ll t; cin>>t; while(t--)
#define UB                             upper_bound
#define LB                             lower_bound
#define BS                             binary_search
#define EB                             emplace_back
#define Max(x,y,z)                     max(x,max(y,z))
#define Min(x,y,z)                     min(x,min(y,z))

const ll MOD     = 1000000007;
const ll SIZE    = 100000;
const int INF    = 0x3f3f3f3f;
const ll ll_INF  = 0x3f3f3f3f3f3f3f3f;
const ld PI      = acos(-1);
const ll MAXN    = numeric_limits<ll>::max();
const ll MAX     = 2000000;
const int N      = 1000001;

ll dp[100005][4];

struct day
{
	ll a,b,c;
};

ll func(ll n, day*arr, ll select)
{
	if(n<=0)
		return 0;

	if(dp[n][select]!=0)
		return dp[n][select];

	if(select==0)
	{
		ll op1=arr[0].a+func(n-1,arr+1,1);
		ll op2=arr[0].b+func(n-1,arr+1,2);
		ll op3=arr[0].c+func(n-1,arr+1,3);
		return dp[n][select]=Max(op1,op2,op3);
	}
	else if(select==1)
	{
		ll op1=arr[0].b+func(n-1,arr+1,2);
		ll op2=arr[0].c+func(n-1,arr+1,3);
		return dp[n][select]=max(op1,op2);
	}
	else if(select==2)
	{
		ll op1=arr[0].a+func(n-1,arr+1,1);
		ll op2=arr[0].c+func(n-1,arr+1,3);
		return dp[n][select]=max(op1,op2);
	}
	else if(select==3)
	{
		ll op1=arr[0].a+func(n-1,arr+1,1);
		ll op2=arr[0].b+func(n-1,arr+1,2);
		return dp[n][select]=max(op1,op2);
	}
	return dp[n][select];
}

void solve()
{
	ll n;
	cin>>n;

	day arr[n];

	for(int i=0; i<n; i++)
	{
		cin>>arr[i].a>>arr[i].b>>arr[i].c;
	}

	ll ans=func(n,arr,0);
	cout<<ans<<endl;    
}

int main()
{
    std::ios::sync_with_stdio(false);

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif

    int t=1;
    //cin>>t;
    while(t--)
    {
      solve();
    }
      return 0;
}

Measured memory_bytes: 15300