N = gets.to_i
a = []
b = []
c = []
N.times{|i|
    a[i], b[i], c[i] = gets.split(" ").map(&:to_i)
}
dp = Array.new(1, Array.new(3, 0))
dp[0][0] = a[0]
dp[0][1] = b[0]
dp[0][2] = c[0]
(1...N).each{|i|
    ar = []
    ar[0] = [dp[i-1][1], dp[i-1][2]].max + a[i]
    ar[1] = [dp[i-1][0], dp[i-1][2]].max + b[i]
    ar[2] = [dp[i-1][0], dp[i-1][1]].max + c[i]
    dp.append(ar)
}
puts [dp[N-1][0], dp[N-1][1], dp[N-1][2]].max