local n=io.read("n")
local t={}
for i=1,n do
    t[i]={}
    for j=1,3 do
        t[i][j]=io.read("n")
    end
end

local dp={}
for i=1,n+1 do
    dp[i]={0,0,0}
end

for i=1,n do
    for j=1,3 do
        for k=1,3 do
            if j~=k then
                dp[i+1][k]=math.max(dp[i+1][k],dp[i][j]+t[i][k])
            end
        end
    end
end

print(math.max(table.unpack(dp[n+1])))