you plan train travel year advance the day year travel give integer array day each day integer 1 365train ticket sell different waysa 1day pass sell costs0 dollarsa 7day pass sell costs1 dollar anda 30day pass sell costs2 dollarsthe pass allow day consecutive travelFor example 7day pass day 2 travel 7 day 2 3 4 5 6 7 8return minimum number dollar need travel day give list day Example 1input day 1467820 cost 2715output 11explanation for example way buy pass let travel travel planOn day 1 buy 1day pass costs0 2 cover day 1on day 3 buy 7day pass costs1 7 cover day 3 4 9on day 20 buy 1day pass costs0 2 cover day 20in total spend 11 cover day travelExample 2input day 123456789103031 cost 2715output 17explanation for example way buy pass let travel travel planOn day 1 buy 30day pass costs2 15 cover day 1 2 30on day 31 buy 1day pass costs0 2 cover day 31in total spend 17 cover day travel Constraints1 dayslength 3651 daysi 365days strictly increase ordercostslength 31 costsi 1000