#include <iostream>
#define MAX 1000
using namespace std;
int min(int a, int b);
int main()
{
int testcase, i, j;
int arr[MAX][3], dp[MAX][3];
cin >> testcase;
for (i = 0; i < testcase; i++)
{
for (j = 0; j < 3; j++)
cin >> arr[i][j];
}
dp[0][0] = arr[0][0];
dp[0][1] = arr[0][1];
dp[0][2] = arr[0][2];
for (i = 1; i < testcase; i++)
{
dp[i][0] = min(dp[i - 1][1], dp[i - 1][2]) + arr[i][0];
dp[i][1] = min(dp[i - 1][0], dp[i - 1][2]) + arr[i][1];
dp[i][2] = min(dp[i - 1][0], dp[i - 1][1]) + arr[i][2];
}
cout << min(min(dp[testcase - 1][0], dp[testcase - 1][1]), dp[testcase - 1][2]) << endl;
return 0;
}
int min(int a, int b)
{
return (a < b) ? a : b;
}