Under construction

Still being built. Things may change

Packing Balls

Interview

Time limit2sMemory limit512 MB

Summary
Given counts of red, green, and blue balls, pack them all into minimum boxes where each box holds 1 to 3 balls of one color or three distinct colors.
Level

Medium6 of 10

Topics
Greedy, Math, Dynamic programming, Implementation
Solved
No attempts yet

Problem

You have RR red balls, GG green balls, and BB blue balls.

Pack all of them into boxes. One box holds 1, 2, or 3 balls.

The balls inside a single box must be all the same color or all different colors.

Write a program that finds the minimum number of boxes needed to pack every ball.

Input

The first line contains RR, GG, and BB, separated by spaces. (1≤R,G,B≤1001 \le R, G, B \le 100)

Output

Print the minimum number of boxes on the first line.

Note

The first example can be packed as (red, green, blue), (red, green), (red, red), (blue, blue, blue).

The second example is packed as (red, green, blue), (green, green, green), (green, green, green).

Examples5

  1. Example 1

    Input
    4 2 4
    
    Expected output
    4
    
  2. Example 2

    Input
    1 7 1
    
    Expected output
    3
    
  3. Example 3

    Input
    2 3 5
    
    Expected output
    4
    
  4. Example 4

    Input
    78 53 64
    
    Expected output
    66
    
  5. Example 5

    Input
    100 100 100
    
    Expected output
    100