#include <bits/stdc++.h>
using namespace std;
long long dp_max(vector<long long> f, map<vector<long long>, long long>& memo) {
  sort(f.begin(), f.end());
  if (memo.find(f) == memo.end()) {
    long long result = 0;
    if (f[0] >= 1) {
      vector<long long> f_new(f);
      f_new[0]--;
      f_new[1]--;
      f_new[2]--;
      result = max(result, dp_max(f_new, memo) + 1);
    }
    if (f[2] >= 3) {
      vector<long long> f_new(f);
      f_new[2] -= 3;
      result = max(result, dp_max(f_new, memo) + 1);
    }
    memo[f] = result;
  }
  return memo[f];
}
int main(void) {
  vector<long long> f(3);
  cin >> f[0] >> f[1] >> f[2];
  long long result = 0;
  for (;;) {
    sort(f.begin(), f.end());
    long long diff_bouquets = f[2] / 3 - f[0] / 3;
    if (diff_bouquets > 1) {
      long long take_bouquets = diff_bouquets - 1;
      result += take_bouquets;
      f[2] -= take_bouquets * 3;
    } else
      break;
  }
  sort(f.begin(), f.end());
  long long take_bouquets = f[0] / 3 - 2;
  if (take_bouquets > 0) {
    f[0] -= take_bouquets * 3;
    result += take_bouquets;
    f[1] -= take_bouquets * 3;
    result += take_bouquets;
    f[2] -= take_bouquets * 3;
    result += take_bouquets;
  }
  map<vector<long long>, long long> memo;
  result += dp_max(f, memo);
  cout << result;
  return 0;
}

### Prompt

Your task is to create a CPP solution to the following problem:

Fox Ciel has some flowers: r red flowers, g green flowers and b blue flowers. She wants to use these flowers to make several bouquets. There are 4 types of bouquets:

  * To make a "red bouquet", it needs 3 red flowers. 
  * To make a "green bouquet", it needs 3 green flowers. 
  * To make a "blue bouquet", it needs 3 blue flowers. 
  * To make a "mixing bouquet", it needs 1 red, 1 green and 1 blue flower. 



Help Fox Ciel to find the maximal number of bouquets she can make.

Input

The first line contains three integers r, g and b (0 ≤ r, g, b ≤ 109) — the number of red, green and blue flowers.

Output

Print the maximal number of bouquets Fox Ciel can make.

Examples

Input

3 6 9


Output

6


Input

4 4 4


Output

4


Input

0 0 0


Output

0

Note

In test case 1, we can make 1 red bouquet, 2 green bouquets and 3 blue bouquets.

In test case 2, we can make 1 red, 1 green, 1 blue and 1 mixing bouquet.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long dp_max(vector<long long> f, map<vector<long long>, long long>& memo) {
  sort(f.begin(), f.end());
  if (memo.find(f) == memo.end()) {
    long long result = 0;
    if (f[0] >= 1) {
      vector<long long> f_new(f);
      f_new[0]--;
      f_new[1]--;
      f_new[2]--;
      result = max(result, dp_max(f_new, memo) + 1);
    }
    if (f[2] >= 3) {
      vector<long long> f_new(f);
      f_new[2] -= 3;
      result = max(result, dp_max(f_new, memo) + 1);
    }
    memo[f] = result;
  }
  return memo[f];
}
int main(void) {
  vector<long long> f(3);
  cin >> f[0] >> f[1] >> f[2];
  long long result = 0;
  for (;;) {
    sort(f.begin(), f.end());
    long long diff_bouquets = f[2] / 3 - f[0] / 3;
    if (diff_bouquets > 1) {
      long long take_bouquets = diff_bouquets - 1;
      result += take_bouquets;
      f[2] -= take_bouquets * 3;
    } else
      break;
  }
  sort(f.begin(), f.end());
  long long take_bouquets = f[0] / 3 - 2;
  if (take_bouquets > 0) {
    f[0] -= take_bouquets * 3;
    result += take_bouquets;
    f[1] -= take_bouquets * 3;
    result += take_bouquets;
    f[2] -= take_bouquets * 3;
    result += take_bouquets;
  }
  map<vector<long long>, long long> memo;
  result += dp_max(f, memo);
  cout << result;
  return 0;
}

```