Taro's summer vacation starts tomorrow, and he has decided to make plans for it now.

The vacation consists of N days. For each i (1 \leq i \leq N), Taro will choose one of the following activities and do it on the i-th day:

* A: Swim in the sea. Gain a_i points of happiness.
* B: Catch bugs in the mountains. Gain b_i points of happiness.
* C: Do homework at home. Gain c_i points of happiness.



As Taro gets bored easily, he cannot do the same activities for two or more consecutive days.

Find the maximum possible total points of happiness that Taro gains.

Constraints

* All values in input are integers.
* 1 \leq N \leq 10^5
* 1 \leq a_i, b_i, c_i \leq 10^4

Input

Input is given from Standard Input in the following format:


N
a_1 b_1 c_1
a_2 b_2 c_2
:
a_N b_N c_N


Output

Print the maximum possible total points of happiness that Taro gains.

Examples

Input

3
10 40 70
20 50 80
30 60 90


Output

210


Input

1
100 10 1


Output

100


Input

7
6 7 8
8 8 3
2 5 2
7 8 6
4 6 8
2 3 4
7 5 1


Output

46
from __future__ import division, print_function

def main():
    n = int(input())
    dp = [0, 0, 0]
    for _ in range(n):
        curr_dp = [0, 0, 0]
        c = [int(_) for _ in input().split()]
        for i in range(3):
            for j in range(3):
                if i != j:
                    curr_dp[j] = max(curr_dp[j], dp[i] + c[j])

        dp = curr_dp

    print(max(dp[0], dp[1], dp[2]))


# PyPy 2 Fast IO Template. Made by Pajenegod & C1729
py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s:self.buffer.write(s.encode('ascii'))
            self.read = lambda:self.buffer.read().decode('ascii')
            self.readline = lambda:self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

# Importing Modules
import math
import collections

from collections import Counter
from math import fabs

if __name__ == "__main__":
    main()