#![allow(unused_imports)] #![allow(non_snake_case)] use std::collections::HashMap; use std::collections::HashSet; #[allow(unused_macros)] macro_rules! read { ([$t:ty] ; $n:expr) => ((0..$n).map(|_| read!([$t])).collect::>()); ($($t:ty),+ ; $n:expr) => ((0..$n).map(|_| read!($($t),+)).collect::>()); ([$t:ty]) => (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::>()); ($t:ty) => (rl().parse::<$t>().unwrap()); ($($t:ty),*) => {{ let buf = rl(); let mut w = buf.split_whitespace(); ($(w.next().unwrap().parse::<$t>().unwrap()),*) }}; } #[allow(dead_code)] fn rl() -> String { let mut buf = String::new(); std::io::stdin().read_line(&mut buf).unwrap(); buf.trim_end().to_owned() } fn main() { let (mut r, mut g, mut b) = read!(usize, usize, usize); // bubble sort(asc) if r > g { std::mem::swap(&mut r, &mut g); } if g > b { std::mem::swap(&mut g, &mut b); } if r > g { std::mem::swap(&mut r, &mut g); } let mut acc = 0; let min = r.min(g).min(b); acc += min; g -= min; b -= min; match (g, b) { (_, 0) => {}, (0, k) => { acc += k / 5; }, (s, t) if s == t => { acc += (s/4) * 2 + (s%4)/3; }, (s, t) if s + 1 == t => { acc += (s/4) + (t%4)/3; }, (s, t) if (t-s)%2 == 0 => { let tmp = (t-s) / 2; acc += tmp; let k = s - tmp; acc += (k/4)*2 + (k%4)/3; }, (s, t) if (t-s)%2 != 0 => { let tmp = (t-s) / 2; acc += tmp; let k = s - tmp; acc += (k/4) + ((k+1)%4)/3; }, _ => {}, } println!("{}", acc); }