a = gets.chomp.split.map(&:to_i)
deri = 0
pisn = 0
while true
  if a[2] > 0 && pisn == 0
    a[2] -= 1
    deri += 1
    pisn = 1
  elsif a[1] > 0
    a[1] -= 1
    deri += 1
    pisn = 1
  elsif a[0] > 0
    a[0] -= 1
    pisn = 1
  else
    puts deri
    break
  end
end