let N = Int(readLine()!)!

var a = 0
var b = 0
var c = 0

for _ in 0..<N {
  let inp = readLine()!.split(separator: " ").map { Int($0)! }
  let a1 = inp[0]
  let b1 = inp[1]
  let c1 = inp[2]
  let _a = a
  let _b = b
  let _c = c
  a = max(_b, _c) + a1
  b = max(_a, _c) + b1
  c = max(_a, _b) + c1
}

print(max(max(a, b), c))