/// Swift5 -> Swift2.2
extension String {
    // split(separator:maxSplits:omittingEmptySubsequences:)
    func split(separator separator: Character) -> [String] {
        return self.characters.split(separator).map(String.init)
    }
}
extension Array {
    // init(repeating:count:)
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
extension Array where Element: Comparable {
    // sorted()
    func sorted() -> [Element] {
        return self.sort( { $0 < $1 } )
    }
}
// stride(from:through:by:)
func stride(from start: Int, through end: Int, by stride: Int) -> StrideThrough<Int> {
    return start.stride(through: end, by: stride)
}
/// end

let N = Int(readLine()!)!

enum Activity {
    case swimming, catching, homework
}

var happiness = [[Activity: Int]]()
happiness.append([:])
for _ in 0 ..< N {
    let input = readLine()!.split(separator: " ").map { Int($0)! }
    happiness.append([
        .swimming: input[0],
        .catching: input[1],
        .homework: input[2]
    ])
}

var dp = Array(repeating: [Activity: Int](), count: N + 1)
dp[1][.swimming] = happiness[1][.swimming]
dp[1][.catching] = happiness[1][.catching]
dp[1][.homework] = happiness[1][.homework]

for i in stride(from: 2, through: N, by: 1) {
    dp[i][.swimming] = max(
        dp[i - 1][.catching]! + happiness[i][.swimming]!,
        dp[i - 1][.homework]! + happiness[i][.swimming]!
    )

    dp[i][.catching] = max(
        dp[i - 1][.swimming]! + happiness[i][.catching]!,
        dp[i - 1][.homework]! + happiness[i][.catching]!
    )

    dp[i][.homework] = max(
        dp[i - 1][.swimming]! + happiness[i][.homework]!,
        dp[i - 1][.catching]! + happiness[i][.homework]!
    )
}

print(dp.last!.map { $1 }.sorted().last!)
