#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
    int n,i,j,k;
    int a[100005][5];
    scanf("%d",&n);
    for(i = 1;i <= n;i++)
    scanf("%d %d %d",&a[i][1],&a[i][2],&a[i][3]);
    int dp[100005][5];
    memset(dp,0,sizeof(dp));
    dp[1][1] = a[1][1];
    dp[1][2] = a[1][2];
    dp[1][3] = a[1][3];
    for(i = 2;i <= n;i++)
    {
        for(j = 1;j < 4;j++)
        {
            for(k = 1;k < 4;k++)
            {
                if(k != j)
                {
                    if(dp[i][j] < dp[i - 1][k] + a[i][j])
                    dp[i][j] = dp[i - 1][k] + a[i][j];
                }
            }
        }
    }
    printf("%d\n",max(dp[n][1],max(dp[n][2],dp[n][3])));
    return 0;
}