#K56662. Maximum Bouquets

    ID: 30249 Type: Default 1000ms 256MiB

Maximum Bouquets

Maximum Bouquets

Given the number of roses (R), tulips (T), and daisies (D), your task is to compute the maximum number of bouquets that can be formed under the following conditions:

  • Each bouquet must consist of exactly three flowers.
  • Each bouquet must contain exactly one tulip.
  • Each bouquet must contain at least one rose.

This implies that in every bouquet, aside from the mandatory tulip and one rose, the third flower can be either a rose or a daisy. Therefore, the number of bouquets is bounded by the minimum of the following:

$$\min\Bigl(R,\;T,\;\Bigl\lfloor\frac{R+D}{2}\Bigr\rfloor\Bigr) $$

Your goal is to compute this value.

inputFormat

The input consists of a single line containing three space-separated integers representing:

  • R: The number of roses
  • T: The number of tulips
  • D: The number of daisies

outputFormat

Output a single integer, the maximum number of bouquets that can be formed.

## sample
6 4 10
4