n=gets.to_i
abc=n.times.map{gets.split.map(&:to_i)}
d=Array.new(n){Array.new(3,0)}
0.upto(2){|j| d[0][j]=abc[0][j]}
1.upto(n-1){|i|
  0.upto(2){|j|
    x=0
    0.upto(2){|k| x=d[i-1][k] if k!=j and x<d[i-1][k]}
    d[i][j]=x+abc[i][j] if d[i][j]<x+abc[i][j] 
}}
puts d[n-1].max