CF1154C.Gourmet Cat

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Polycarp has a cat and his cat is a real gourmet! Dependent on a day of the week he eats certain type of food:

  • on Mondays, Thursdays and Sundays he eats fish food;
  • on Tuesdays and Saturdays he eats rabbit stew;
  • on other days of week he eats chicken stake.

Polycarp plans to go on a trip and already packed his backpack. His backpack contains:

  • aa daily rations of fish food;
  • bb daily rations of rabbit stew;
  • cc daily rations of chicken stakes.

Polycarp has to choose such day of the week to start his trip that his cat can eat without additional food purchases as long as possible. Print the maximum number of days the cat can eat in a trip without additional food purchases, if Polycarp chooses the day of the week to start his trip optimally.

输入格式

The first line of the input contains three positive integers aa , bb and cc ( 1a,b,c71081 \le a, b, c \le 7\cdot10^8 ) — the number of daily rations of fish food, rabbit stew and chicken stakes in Polycarps backpack correspondingly.

输出格式

Print the maximum number of days the cat can eat in a trip without additional food purchases, if Polycarp chooses the day of the week to start his trip optimally.

输入输出样例

  • 输入#1

    2 1 1
    

    输出#1

    4
    
  • 输入#2

    3 2 2
    

    输出#2

    7
    
  • 输入#3

    1 100 1
    

    输出#3

    3
    
  • 输入#4

    30 20 10
    

    输出#4

    39
    

说明/提示

In the first example the best day for start of the trip is Sunday. In this case, during Sunday and Monday the cat will eat fish food, during Tuesday — rabbit stew and during Wednesday — chicken stake. So, after four days of the trip all food will be eaten.

In the second example Polycarp can start his trip in any day of the week. In any case there are food supplies only for one week in Polycarps backpack.

In the third example Polycarp can start his trip in any day, excluding Wednesday, Saturday and Sunday. In this case, the cat will eat three different dishes in three days. Nevertheless that after three days of a trip there will be 9999 portions of rabbit stew in a backpack, can cannot eat anything in fourth day of a trip.

首页