let n = Int(readLine()!)!

let tasks = (1...n).map { _ in
    return readLine()!.split(separator: " ").map { Int($0)! }
}

var dpA = [Int](repeating: 0, count: n)
var dpB = [Int](repeating: 0, count: n)
var dpC = [Int](repeating: 0, count: n)

dpA[0] = tasks[0][0]
dpB[0] = tasks[0][1]
dpC[0] = tasks[0][2]
for i in 1..<n {
    dpA[i] = tasks[i][0] + max(dpB[i-1], dpC[i-1])
    dpB[i] = tasks[i][1] + max(dpA[i-1], dpC[i-1])
    dpC[i] = tasks[i][2] + max(dpA[i-1], dpB[i-1])
}

print(max(dpA[n-1], dpB[n-1], dpC[n-1]))