- محدودیت زمان: ۱ ثانیه
- محدودیت حافظه: ۲۵۶ مگابایت
Sara, who is deeply concerned about air pollution, has sold her car and bought a horse. She happily leads the horse to the parking lot and takes a very long string of pasta from the kitchen, which she gives to the horse. The horse happily takes several bites of pasta. Sara’s father, who notices the disappearance of the pasta string, finds the remaining pieces of pasta in the parking lot. Being an intelligent person, he knows that the horse selects a piece of pasta longer than 3 inches for each bite. Then, by biting 3 inches from the middle of the selected piece, she divides it into two pieces.
Given the lengths of the remaining pasta pieces, help Sara’s father determine the length of the initial pasta string.
ورودی
The first line of the input contains an integer , which is the number of remaining pasta pieces. The next line contains a sequence of integers, where represents the length of the -th remaining pasta piece.
خروجی
In the only line of output, print the length of the initial pasta string.
ورودی نمونه ۱
خروجی نمونه ۱
ورودی نمونه ۲
خروجی نمونه ۲
ارسال پاسخ برای این سؤال