local n = io.read("*n")
local x, y, z = io.read("*n", "*n", "*n")
local mma = math.max
for i = 2, n do
  local a, b, c = io.read("*n", "*n", "*n")
  x, y, z = mma(y, z) + a, mma(x, z) + b, mma(x, y) + c
end
print(mma(x, mma(y, z)))
