n=gets.to_i
dp=Array.new(100010){[0]*3}
point=[]
n.times.each do
    point<<gets.split.map(&:to_i)
end

for i in 0..n-1
    for j in 0..2
        for k in 0..2
        dp_each=[]
       if j==k
        next
        else
       dp[i+1][j]=[dp[i][k]+point[i][j],dp[i+1][j]].max
        end
       end
    end
end

#p dp[0..5]
p dp[n].max