Public Class Program
  Shared Sub Main()
    Dim n As Long = Long.Parse(Console.ReadLine())
    Dim dp(0 To n) As Long
    dp(0) = 0
    Dim lastActivity As Integer = -1 ' 0 = a, 1 = b, 2 = c '
    For i As Long = 1 To n
      Dim abc As Long() = Array.ConvertAll(Of String, Long)(Console.ReadLine().Split(" "), AddressOf Long.Parse)
      Dim a As Long = abc(0)
      Dim b As Long = abc(1)
      Dim c As Long = abc(2)
      Dim maxHappiness As Long = 0
      Select Case lastActivity
        Case -1
          maxHappiness = Math.Max(a, Math.Max(b, c))
          Select Case maxHappiness
            Case a
              lastActivity = 0
            Case b
              lastActivity = 1
            Case c
              lastActivity = 2
          End Select
        Case 0
          maxHappiness = Math.Max(b, c)
          lastActivity = If(maxHappiness = b, 1, 2)
        Case 1
          maxHappiness = Math.Max(c, a)
          lastActivity = If(maxHappiness = c, 2, 0)
        Case 2
          maxHappiness = Math.Max(a, b)
          lastActivity = If(maxHappiness = a, 0, 1)
      End Select
      dp(i) = dp(i - 1) + maxHappiness
    Next
    Console.WriteLine(dp(n).ToString())
  End Sub
End Class