PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GD0000179. Trang trí bàn tiệc (Table Decorations)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Trang trí bàn tiệc (Table Decorations)

Table Decorations

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

A banquet has rr red balloons, gg green balloons, and bb blue balloons. Decorating one table requires exactly three balloons, and those three must not all have the same color. Each balloon can be assigned to at most one table. Some balloons may remain unused. Find the maximum number of tables that can be decorated.

Input

The only line contains three nonnegative integers rr, gg, and bb: the numbers of red, green, and blue balloons, respectively.

Output

Print one integer: the maximum number of tables that can each receive exactly three balloons without all three having the same color.

Subtasks

  • Subtask 1 (20 points): 0≤r,g,b≤300\le r,g,b\le 30.
  • Subtask 2 (30 points): 0≤r,g,b≤1000000\le r,g,b\le 100000.
  • Subtask 3 (50 points): 0≤r,g,b≤20000000000\le r,g,b\le 2000000000.

Examples

Example 1

Input

5 4 3

Output

4

Explanation

There are 5+4+3=125+4+3=12 balloons, so at most 12/3=412/3=4 tables are possible. Four valid triples are (red, green, green), (green, blue, blue), (blue, red, red), and (red, red, green). They use exactly all 55 red, 44 green, and 33 blue balloons; no triple is monochromatic. Hence the answer is 44.

Example 2

Input

1 1 1

Output

1

Explanation

There is one balloon of each color. The three balloons decorate one table and are not all the same color. No balloons remain for another table.