Company: Winzo_30july
Difficulty: medium
PK's World Tour Problem Description PK sets out on a world tour and has fixed his itinerary in advance. He strictly follows that itinerary, so the order of the places he visits is fixed and the only thing left to decide is how he travels on each leg of the trip. There are N journeys in the tour, taken one after another. For every journey PK may choose one of three modes of transport: Plane , Ship or Helicopter . The cost of a journey depends on both the journey and the mode chosen. PK finds it boring to travel by the same mode of transport on two journeys that come one after the other, so he never uses the same mode on two consecutive journeys. Find the minimum possible total cost of the whole tour. Input Format The first line contains a single integer N . Each of the next N lines contains three space-separated integers: the cost of that journey by Plane, by Ship and by Helicopter, in that order. (inferred - the source calls N the number of countries but then supplies exactly N cost li