import std.stdio; import std.string; import std.conv; import std.algorithm; import std.math; import std.array; void main(){ auto stones = readln.chomp.split(" ").map!(to!int).array; int res; int tempMin = stones.reduce!min; res += tempMin; stones = stones.map!((e) => e - tempMin).array.sort; int canMake(int[] s, int acc){ bool cond1 = s[2]>2 && s[1]>=1; bool cond2 = s[2]>4 && s[1]<1; if(cond1){ s[2] -= 3; s[1] -= 1; return canMake(s.sort, acc + 1); } else if(cond2){ s[2] -= 5; return canMake(s.sort, acc+1); } else{ return acc; } } res += canMake(stones, 0); res.writeln; }