let n = stdin.ReadLine() |> int
let abc =
    [|1..n|]
    |> Array.map (fun _ -> stdin.ReadLine().Split() |> Array.map int)

abc
|> Array.scan (fun [|la;lb;lc|] [|a;b;c|] -> [|a+max lb lc;b+max lc la;c+max la lb|]) [|0;0;0|]
|> fun x -> x.[n] |> Array.max
|> stdout.WriteLine