#include <bits/stdc++.h>
using namespace std;

namespace cp {
	#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
	#define ROF(i, a, b) for (int i = (b); i >= (a); i--)
	#define REP(a) for (int i = 0; i < (a); i++)
	#define pb push_back
 
	typedef long long ll;
	typedef vector<int> vi;
	
	const ll INF = 9223372036854775807;
	const int MOD = 1e9 + 7;
	
	// to_string methods
	string ts(int n) { return to_string(n); }
	string ts(double n) { return to_string(n); }
	string ts(long double n) { return to_string(n); }
	string ts(long long n) { return to_string(n); }
	string ts(char c) { return to_string(c); }
	string ts(bool b) { return b ? "true" : "false"; }
	string ts(string s) { return s; }
	
	template <typename T, typename V>
	string ts(pair<T,V> p) {
		return "{" + ts(p.first) + ", " + ts(p.second) + "}";
	}
	
	template <typename T>
	string ts(T arr[], int len) {
		ostringstream oss;
		oss << "[";
		string delim = "";
		for (int i = 0; i < len; i++) {
		   oss << delim << ts(arr[i]);
		   delim = ", ";
		}
		oss << "]";
		return oss.str();
	}
	
	template<typename Container>
	string ts(const Container &v) {
		ostringstream oss;
		oss << "[";
		string delim = "";
		for (const auto &x : v) {
		   oss << delim << ts(x);
		   delim = ", ";
		}
		oss << "]";
		return oss.str();
	}
	
	template <typename T, typename V>
	string ts(map<T,V> m) {
		ostringstream oss;
		oss << "[";
		string delim = "";
		for (pair<T,V> p : m) {
		   oss << delim;
		   oss << "{" << p.first << ": " << p.second << "}";
		   delim = ", ";
		}
		oss << "]";
		return oss.str();
	}
	
	struct custom_hash {
	    static uint64_t splitmix64(uint64_t x) {
	        // http://xorshift.di.unimi.it/splitmix64.c
	        x += 0x9e3779b97f4a7c15;
	        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
	        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
	        return x ^ (x >> 31);
	    }
	    
	    size_t operator()(uint64_t x) const {
        	static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        	return splitmix64(x + FIXED_RANDOM);
    	}
	    
	    size_t operator()(pair<uint64_t,uint64_t>& x) const {
			static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
			return splitmix64(x.first + FIXED_RANDOM)^(splitmix64(x.second + FIXED_RANDOM) >> 1);
		}
	};
	
	// IO
	void setI(string s) { freopen(s.c_str(), "r", stdin); }
	void setO(string s) { freopen(s.c_str(), "w", stdout); }
	void setIO(string s1, string s2) { setI(s1); setO(s2); }
	void setUsacoIO(string s) { setIO(s + ".in", s + ".out"); }
	
	// Sorting lambda syntax
//	auto check = [&](int x, int y) {
//	    return x < y;
//	};
//
//	set<int, decltype(check)> s(check);
//	map<int, int, decltype(check)> mp(check);
//	priority_queue<int, vi, decltype(check)> pq(check); // remember pq.top() is the largest by default (descending order)
}
using namespace cp;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
	
    int n;
    cin >> n;

    int c[3][n];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> c[j][i];
        }
    }

    int dp[n][3]; // j = cur activity (0,1,2)
    memset(dp, -1, sizeof(dp));
    dp[0][0] = c[0][0];
    dp[0][1] = c[1][0];
    dp[0][2] = c[2][0];

    for (int i = 1; i < n; i++) {
        for (int j = 0; j < 3; j++) {
            for (int prevJ = 0; prevJ < 3; prevJ++) {
                if (prevJ != j) {
                    dp[i][j] = max(dp[i][j], dp[i-1][prevJ] + c[j][i]);
                }
            }
        }
    }

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

    return 0;
}

Measured memory_bytes: 5996