function Main(input) {
  var tmp = input.trim()
  var N = parseInt(tmp.split(' ')[0])
  var A = parseInt(tmp.split(' ')[1])
  var B = parseInt(tmp.split(' ')[2])

  var stock = { blue: '', red: '' }

  for (var i = 1; i <= A; i++) {
    stock['blue'] = stock['blue'] + 'b'

  }

  for (var i = 1; i <= B; i++) {
    stock['red'] = stock['red'] + 'r'
  }

  var str = ''
  var j = 0
  var ball = ['blue', 'red']

  while (str.length < N) {
    str = str + stock[ball[j % 2]]
    j = j + 1
  }

  var strSplited = str.split('')
  var result = 0

  for (var k = 0; k < N; ++k) {
    if (strSplited[k] === 'b') {
      result = result + 1
    }
  }

  console.log(result)
  return result
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'))