Language: C

import java.io.PrintWriter
import java.util.*
import java.math.*
import java.lang.*
import kotlin.comparisons.*

val pw = PrintWriter(System.out)
val MOD: Long = (1e+9 + 7).toLong()

fun main(args: Array<String>) {
    val (n, a, b) = readListOfLong()

    val ab = a + b
    val num = n / ab
    val rest = n % ab
    val bRest = if(rest > a) a else rest

    println(num * a + bRest)
	pw.flush()
}

/****** Declared Functions and Data Structures ******/
// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }

fun Double.format(digits: Int) = String.format("%.${digits}f", this)
fun Float.format(digits: Int) = String.format("%.${digits}f", this)

fun print(value: Any) { pw.print(value) }
fun println(value : Any) { pw.println(value) }

// Extensions
fun<T> List<T>.toBuckets(): Map<T, Int>
	= this.groupBy { it }.mapValues { it.value.size }

fun<T: Comparable<T>> List<T>.upperBound(element: T, fromIndex: Int=0, toIndex: Int=this.size): Int {
	var l = fromIndex
	var r = toIndex
	while(l < r) {
		val mid = (l+r) / 2
		if(element >= this[mid]) { 
			l = mid + 1
		} else {
			r = mid
		}
	}
	return l
}

fun<T: Comparable<T>> List<T>.lowerBound(element: T, fromIndex: Int=0, toIndex: Int=this.size): Int {
	var l = fromIndex
	var r = toIndex
	while(l < r) {
		val mid = (l+r) / 2
		if(element <= this[mid]) { 
			r = mid
		} else {
			l = mid + 1
		}
	}
	return r 
}

fun <K, V> Map<K, V>.toMutableMap(): MutableMap<K, V> = HashMap(this)

// Util Functions
fun Long.makeDivisors(): List<Long> {
	val divisors = mutableListOf<Long>()
	for(i in 1L .. Math.sqrt(this.toDouble()).toLong()+1L) {
		if(this % i == 0L) {
			divisors.add(i)
			if(i != this/i) {
				divisors.add(this/i)
			}
		}
	}
	return divisors.distinct().sorted()
}

fun Long.isPrime(): Boolean {
	if(this==1L) return false
	for(i in 2L .. Math.sqrt(this.toDouble()).toLong() + 1L) {
		if(this % i == 0L && this != i) {
			return false
		}
	}
	return true
}


fun<T> permutations(src: List<T>): List<List<T>> {
	if(src.size == 1) return listOf(src)
	val perms = mutableListOf<List<T>>()
	val insertElement = src[0]
	permutations(src.drop(1)).forEach { perm ->
		for(i in 0..perm.size) {
			val newPerm = perm.toMutableList()
			newPerm.add(i, insertElement)
			perms.add(newPerm.toList())
		}
	}
	return perms
}

// return nCr, if you want nCr, please access v[n][r]
fun combinations(n: Long): List<List<Long>> {
	val v = (0..n).map { (0..n).map{0L}.toMutableList() }.toMutableList()
	for(i in 0 until v.size) {
		v[i][0] = 1L
		v[i][i] = 1L
	}
	for(i in 0 until v.size) {
		for(j in 1 until i) {
			v[i][j] = (v[i-1][j-1] + v[i-1][j]) % MOD
		}
	}
	return v.map { it.toList() }.toList()
}

fun repeatedModPow(a: Long, n: Long, mod: Long): Long = 
	when {
		n == 1L -> a % mod
		n % 2L == 1L -> (a * repeatedModPow(a, n-1L, mod)) % mod
		else -> {
			val tmp = repeatedModPow(a, n / 2L, mod)
			(tmp * tmp) % mod
		}
	}

// return nCr % MOD
fun modnCkWithoutArray(n: Long, k: Long, mod: Long): Long {
	var ret = 1L
	val min = Math.min(k, n-k)
	// まず分母の計算
	for(i in n downTo (n - min + 1)) {
		ret = ret * i % mod
	}
	for(i in min downTo 1) {
		ret = ret * repeatedModPow(i, (mod - 2L), mod) % mod
	}
	return ret
}

// return nCr % MOD
fun modnCk(n: Int, k: Int, mod: Long): Long {
	val factorials = Array(n+1) { 0L }.apply {
		this[0] = 1L
		if(this.size > 1) this[1] = 1L
	}
	val inverses = Array(n+1) { 0L }.apply {
		this[0] = 1L
		if(this.size > 1) this[1] = 1L
	}
	val factorialInverses = Array(n+1) { 0L }.apply {
		this[0] = 1L
		if(this.size > 1) this[1] = 1L
	}
	for(i in 2 .. n) {
		factorials[i] = (factorials[i-1] * i.toLong() % mod)
		inverses[i] = (mod - inverses[mod.toInt() % i] * (mod / i.toLong()) % mod)
		factorialInverses[i] = (factorialInverses[i-1] * inverses[i] % mod)
	}

	return factorials[n] % mod * (factorialInverses[k] * factorialInverses[n-k] % mod) % mod
}

// should be a >= b
fun gcd(a: Long, b: Long): Long = 
	if(b == 0L) a else gcd(b, a % b)

// shoud be a >= b
fun lcm(a: Long, b: Long): Long = 
	a / gcd(a, b) * b

fun sumDigits(num_: Long): Long {
	var num = num_
	var rtn: Long = 0
	while(num != 0.toLong()) {
		val tmp = num % 10
		rtn += tmp
		num /= 10
	}
	return rtn
}

fun Double.isDecimal(): Boolean = ((this - Math.floor(this)) != 0.0)

// Data Structures
class Stack<T>(private var st: MutableList<T> = mutableListOf<T>()) {
	fun isEmpty() = st.isEmpty()
	fun top(): T = st.last()
	fun push(e: T) { st.add(e) }
	fun pop() { st = st.dropLast(1).toMutableList() }
}

class Queue<T>(private var que: MutableList<T> = mutableListOf<T>()) {
	fun isEmpty() = que.isEmpty()
	fun top(): T = que.first()
	fun push(e: T) { que.add(e) }
	fun pop() { que = que.drop(1).toMutableList() }
}


Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import java.io.PrintWriter
      | ^~~~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    1 | import java.io.PrintWriter
      |            ^
main.c:24:1: error: unknown type name 'fun'
   24 | fun read() = readLine()!!
      | ^~~
main.c:24:1: error: function 'read' is initialized like a variable
main.c:24:14: error: implicit declaration of function 'readLine' [-Wimplicit-function-declaration]
   24 | fun read() = readLine()!!
      |              ^~~~~~~~
main.c:24:24: error: expected ',' or ';' before '!' token
   24 | fun read() = readLine()!!
      |                        ^
main.c:30:1: error: unknown type name 'fun'
   30 | fun readListOfLong() = readListOfString().map { it.toLong() }
      | ^~~
main.c:30:1: error: function 'readListOfLong' is initialized like a variable
main.c:30:24: error: implicit declaration of function 'readListOfString'; did you mean 'readListOfLong'? [-Wimplicit-function-declaration]
   30 | fun readListOfLong() = readListOfString().map { it.toLong() }
      |                        ^~~~~~~~~~~~~~~~
      |                        readListOfLong
main.c:30:42: error: request for member 'map' in something not a structure or union
   30 | fun readListOfLong() = readListOfString().map { it.toLong() }
      |                                          ^
main.c:30:47: error: expected ',' or ';' before '{' token
   30 | fun readListOfLong() = readListOfString().map { it.toLong() }
      |                                               ^
main.c:31:1: error: unknown type name 'fun'
   31 | fun readListOfDouble() = readListOfString().map { it.toDouble() }
      | ^~~
main.c:31:1: error: function 'readListOfDouble' is initialized like a variable
main.c:31:44: error: request for member 'map' in something not a structure or union
   31 | fun readListOfDouble() = readListOfString().map { it.toDouble() }
      |                                            ^
main.c:31:49: error: expected ',' or ';' before '{' token
   31 | fun readListOfDouble() = readListOfString().map { it.toDouble() }
      |                                                 ^
main.c:33:1: error: unknown type name 'fun'
   33 | fun Double.format(digits: Int) = String.format("%.${digits}f", this)
      | ^~~
main.c:33:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
   33 | fun Double.format(digits: Int) = String.format("%.${digits}f", this)
      |           ^
main.c:37:1: error: unknown type name 'fun'
   37 | fun println(value : Any) { pw.println(value) }
      | ^~~
main.c:37:18: error: expected ')' before ':' token
   37 | fun println(value : Any) { pw.println(value) }
      |                  ^~
      |                  )
main.c:40:4: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   40 | fun<T> List<T>.toBuckets(): Map<T, Int>
      |    ^
main.c:41:30: error: expected identifier or '(' before '.' token
   41 |         = this.groupBy { it }.mapValues { it.value.size }
      |                              ^
main.c:43:4: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   43 | fun<T: Comparable<T>> List<T>.upperBound(element: T, fromIndex: Int=0, toIndex: Int=this.size): Int {
      |    ^
main.c:57:4: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   57 | fun<T: Comparable<T>> List<T>.lowerBound(element: T, fromIndex: Int=0, toIndex: Int=this.size): Int {
      |    ^
main.c:71:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   71 | fun <K, V> Map<K, V>.toMutableMap(): MutableMap<K, V> = HashMap(this)
      |     ^
main.c:87:1: error: unknown type name 'fun'
   87 | fun Long.isPrime(): Boolean {
      | ^~~
main.c:87:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
   87 | fun Long.isPrime(): Boolean {
      |         ^
main.c:98:4: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   98 | fun<T> permutations(src: List<T>): List<List<T>> {
      |    ^
main.c:103:26: error: too many decimal points in number
  103 |                 for(i in 0..perm.size) {
      |                          ^~~~~~~~~~~~
main.c:113:1: error: unknown type name 'fun'
  113 | fun combinations(n: Long): List<List<Long>> {
      | ^~~
main.c:113:19: error: expected ')' before ':' token
  113 | fun combinations(n: Long): List<List<Long>> {
      |                   ^
      |                   )
main.c:114:18: error: too many decimal points in number
  114 |         val v = (0..n).map { (0..n).map{0L}.toMutableList() }.toMutableList()
      |                  ^~~~
main.c:114:31: error: too many decimal points in number
  114 |         val v = (0..n).map { (0..n).map{0L}.toMutableList() }.toMutableList()
      |                               ^~~~
main.c:127:1: error: unknown type name 'fun'
  127 | fun repeatedModPow(a: Long, n: Long, mod: Long): Long =
      | ^~~
main.c:127:21: error: expected ')' before ':' token
  127 | fun repeatedModPow(a: Long, n: Long, mod: Long): Long =
      |                     ^
      |                     )
main.c:138:1: error: unknown type name 'fun'
  138 | fun modnCkWithoutArray(n: Long, k: Long, mod: Long): Long {
      | ^~~
main.c:138:25: error: expected ')' before ':' token
  138 | fun modnCkWithoutArray(n: Long, k: Long, mod: Long): Long {
      |                         ^
      |                         )
main.c:152:1: error: unknown type name 'fun'
  152 | fun modnCk(n: Int, k: Int, mod: Long): Long {
      | ^~~
main.c:152:13: error: expected ')' before ':' token
  152 | fun modnCk(n: Int, k: Int, mod: Long): Long {
      |             ^
      |             )
main.c:175:1: error: unknown type name 'fun'
  175 | fun gcd(a: Long, b: Long): Long =
      | ^~~
main.c:175:10: error: expected ')' before ':' token
  175 | fun gcd(a: Long, b: Long): Long =
      |          ^
      |          )
main.c:185:22: error: invalid suffix "toLong" on floating constant
  185 |         while(num != 0.toLong()) {
      |                      ^~~~~~~~
main.c:193:1: error: unknown type name 'fun'
  193 | fun Double.isDecimal(): Boolean = ((this - Math.floor(this)) != 0.0)
      | ^~~
main.c:193:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
  193 | fun Double.isDecimal(): Boolean = ((this - Math.floor(this)) != 0.0)
      |           ^
main.c:203:1: error: unknown type name 'class'
  203 | class Queue<T>(private var que: MutableList<T> = mutableListOf<T>()) {
      | ^~~~~
main.c:203:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
  203 | class Queue<T>(private var que: MutableList<T> = mutableListOf<T>()) {
      |            ^