// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

const double pi = acos(-1);

#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)

#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)

#define REP(i,n) FOR(i,0,n)

#define RREP(i,n) RFOR(i,0,n)

#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME

#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)

#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)

template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {

    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}

template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {

    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}



template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }







int main(int argc, const char * argv[]) {

    

   

    

    //input

    ll n; cin >> n;

    ll HP[100100][3];

    ll DP[100100][3];

    memset(DP, 0, sizeof(DP));

    memset(HP, 0, sizeof(HP));

    

    rep(i,n) cin >> HP[i][0] >> HP[i][1] >> HP[i][2];

    

    //DP

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

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

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

                if(j==k) continue;

                chmax( DP[i][j], DP[i - 1][k] + HP[i - 1][k]);

            }

        }

    }

    

    cout << max( { DP[n][0], DP[n][1], DP[n][2]}) << endl;

    

    

}


// Optimized solution to the same problem (faster):
#ifndef _GLIBCXX_NO_ASSERT

#include <cassert>

#endif

#include <cctype>

#include <cerrno>

#include <cfloat>

#include <ciso646>

#include <climits>

#include <clocale>

#include <cmath>

#include <csetjmp>

#include <csignal>

#include <cstdarg>

#include <cstddef>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <ctime>



#if __cplusplus >= 201103L

#include <ccomplex>

#include <cfenv>

#include <cinttypes>

#include <cstdbool>

#include <cstdint>

#include <ctgmath>

#include <cwchar>

#include <cwctype>

#endif



// C++

#include <algorithm>

#include <bitset>

#include <complex>

#include <deque>

#include <exception>

#include <fstream>

#include <functional>

#include <iomanip>

#include <ios>

#include <iosfwd>

#include <iostream>

#include <istream>

#include <iterator>

#include <limits>

#include <list>

#include <locale>

#include <map>

#include <memory>

#include <new>

#include <numeric>

#include <ostream>

#include <queue>

#include <set>

#include <sstream>

#include <stack>

#include <stdexcept>

#include <streambuf>

#include <string>

#include <typeinfo>

#include <utility>

#include <valarray>

#include <vector>



#if __cplusplus >= 201103L

#include <array>

#include <atomic>

#include <chrono>

#include <condition_variable>

#include <forward_list>

#include <future>

#include <initializer_list>

#include <mutex>

#include <random>

#include <ratio>

#include <regex>

#include <scoped_allocator>

#include <system_error>

#include <thread>

#include <tuple>

#include <typeindex>

#include <type_traits>

#include <unordered_map>

#include <unordered_set>

#endif





using namespace std;

using ll = long long;



const ll MOD = 1000000007;

const ll INF = 1e18;

const double pi = acos(-1);

const int dx4[4] = {1, 0, -1, 0};

const int dy4[4] = {0, 1, 0, -1};

const int dx8[8] = {1,1,0,-1,-1,-1,0,1};

const int dy8[8] = {0,1,1,1,0,-1,-1,-1};





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

#define rep(i,b) rng(i,0,b)

#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)

#define per(i,b) gnr(i,0,b)

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

#define rALL(obj) (obj).rbegin(), (obj).rend()





template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }











void solve(){

    

    // remove the bottom 3 lines when you submit this code.

    std::ifstream in("sample.txt");

    std::cin.rdbuf(in.rdbuf());



    cin.tie(0);

    ios::sync_with_stdio(false);

    

    int n; cin >> n;

    int dp[100010][3];

    int h[100010][3];

    rep(i,n) cin >> h[i][0] >> h[i][1] >> h[i][2];

    

    dp[0][0] = h[0][0];

    dp[0][1] = h[0][1];

    dp[0][2] = h[0][2];

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

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

            dp[i+1][0] = max(dp[i][1],dp[i][2]) + h[i+1][0];

            dp[i+1][1] = max(dp[i][2],dp[i][0]) + h[i+1][1];

            dp[i+1][2] = max(dp[i][0],dp[i][1]) + h[i+1][2];

        }

    }

    

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

    

    

}







signed main() {

    

    

    solve();

    return 0;

}




// Fastest known solution for this problem: