• محدودیت زمان: ۱ ثانیه
  • محدودیت حافظه: ۲۵۶ مگابایت

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 nn (1n100)(1 \leq n \leq 100), which is the number of remaining pasta pieces. The next line contains a sequence l1,l2,,lnl_1, l_2, \dots, l_n of nn integers, where lil_i (1li1000)(1 \leq l_i \leq 1000) represents the length of the ii-th remaining pasta piece.

خروجی

In the only line of output, print the length of the initial pasta string.

ورودی نمونه ۱

2
2 5
Plain text

خروجی نمونه ۱

10
Plain text

ورودی نمونه ۲

2
2 5
Plain text

خروجی نمونه ۲

10
Plain text

ارسال پاسخ برای این سؤال
فایلی انتخاب نشده است.