jiahuimbzuai/CoQuIR huggingface dataset:
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func max(a int, b int) int {
	if a >= b {
		return a
	}
	return b
}

func solve(A int, B int64, N int64) int64 {
	var x int64 = B - 1
	if x > N {
		x = N
	}
	return (int64(A) * x / B) - (int64(A) * (x / B))
}

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	hoge := sc.Text()
	i, e := strconv.Atoi(hoge)
	if e != nil {
		panic(e)
	}
	return i
}

func nextInt64() int64 {
	sc.Scan()
	hoge := sc.Text()
	i, e := strconv.ParseInt(hoge, 0, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	A, B, N := nextInt(), nextInt64(), nextInt64()
	fmt.Println(solve(A, B, N))
}
//  [go]
package main

import "fmt"

func main() {
	var a, b, n int
	fmt.Scan(&a, &b, &n)

	x := min(n, b-1)
	v := f(a, b, x)
	fmt.Println(v)
}

func f(a, b, x int) int {
	return (a * x / b) - a*(x/b)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
//  [go]
package main

import (
	"fmt"
	"math"
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func main() {
	var a, b, n float64
	fmt.Scan(&a, &b, &n)

	x := float64(min(int(b-1), int(n)))
	fmt.Println(int(math.Floor(a*x/b)) - int(a)*int(math.Floor(x/b)))
}
//  [go]
package main

import (
	"fmt"
	"math"
)

func main() {
	// Code for D - Floor Function
	var A, B int
	var N int
	fmt.Scan(&A, &B, &N)

	/*
		var ans int
		var max int

		for i := 0; i <= B-1; i++ {
			ans = int(math.Ceil(float64((A * i) / B)))
			if max < ans {
				max = ans
			}
		}
	*/

	//fmt.Println(max)
	fmt.Println(int(math.Min(math.Ceil(float64((A*N)/B)), math.Ceil(float64((A*B-1)/B)))))
}
//  [go]
package main

import (
	"fmt"
	"math"
)

func main() {
	// Code for D - Floor Function
	var A, B int
	var N int
	fmt.Scan(&A, &B, &N)

	var ans int
	var max int
	var temp int
	for i := 1; i <= N; i++ {
		ans = int(math.Ceil(float64((A*i)/B))) - A*int(math.Ceil(float64(i/B)))
		if temp > ans {
			break
		}

		if max < ans {
			max = ans
		}
		temp = ans
		//fmt.Println(ans)
	}

	fmt.Println(max)
}
//  [go]
package main

import (
	"fmt"
	"math"
)

func main() {
	// Code for D - Floor Function
	var A, B int
	var N int
	fmt.Scan(&A, &B, &N)

	var ans int
	var max int
	for i := 1; i <= N; i++ {
		ans = int(math.Ceil(float64((A*i)/B))) - A*int(math.Ceil(float64(i/B)))
		if max < ans {
			max = ans
		}
	}

	fmt.Println(max)
}
//  [ruby]
A,B,N=$<.read.split.map(&:to_i)

if N < B
    x = N
else
    x = N/B*B-1
end
ret = (A*x)/B - A*(x/B)
puts ret
//  [ruby]
def func(a, b, x)
  (a*x)/b - a*(x/b)
end

a, b, n = gets.strip.split.map(&:to_i)
p func(a, b, [n, b-1].min)
//  [ruby]
a, b, n = gets.chomp.split.map(&:to_i)

x = [b - 1, n].min
b = b.to_f

t = (a * x / b).floor - a * (x / b).floor

puts t
//  [ruby]
a, b, n = gets.split(" ").map &:to_i
x = 1
ans = 0
while x <= b && x <= n
  max = ((a*x)/b).floor - a*(x/b).floor
  if ans < max
    ans = max
  end
  x += 1
end
puts ans
//  [ruby]
a,b,n = gets.split.map &:to_i

puts (0..n).map{|x|(a.to_r * x/ b).to_i - a * (x.to_r/b).to_i}.max
//  [ruby]
result=[]
a,b,n=gets.split.map(&:to_i)

for i in 1..n
    
    v=(a*i).div(b)
    v=v.to_i
    vv=i.div(b)
    vv=vv.to_i
    answer=v-a*vv
    if i==1
    result[i-1]=answer
    elsif answer>=result[i-2]
    result[i-1]=answer
    elsif answer<result[i-2]
    p result[i-2]
    exit
    end
end
 p result[-1]
//  [rust]
/* #region template */
#![allow(unused_imports)]
use std::cmp::{max, min};
use std::io::{stdin, stdout, Bytes, Read, Stdin, StdinLock, Stdout, StdoutLock, Write};
use std::iter::{repeat, repeat_with};
use std::mem::swap;
use std::str::FromStr;
#[allow(dead_code)]
struct Io<'a> {
    reader: Bytes<StdinLock<'a>>,
    writer: StdoutLock<'a>,
    in_buf: [u8; BUF_SIZE],
}
#[allow(dead_code)]
impl<'a> Io<'a> {
    fn new(stdin: &'a Stdin, stdout: &'a Stdout) -> Io<'a> {
        Io {
            reader: stdin.lock().bytes(),
            writer: stdout.lock(),
            in_buf: [0; BUF_SIZE],
        }
    }
    fn r<T: FromStr>(&mut self) -> T {
        let mut count = 0;
        loop {
            match self.reader.next() {
                Some(Ok(b' ')) | Some(Ok(b'\n')) => break,
                Some(Ok(c)) => self.in_buf[count] = c,
                _ => panic!(),
            }
            count += 1;
        }

        let s = unsafe { std::str::from_utf8_unchecked(&self.in_buf[0..count]) };
        s.parse().unwrap_or_else(|_| panic!())
    }
    fn ru(&mut self) -> usize {
        self.r()
    }
    fn iter<'b, T>(&'b mut self) -> IoIter<'a, 'b, T> {
        IoIter::new(self)
    }
    fn c<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        self.iter().take(n).collect()
    }
    fn cu(&mut self, n: usize) -> Vec<usize> {
        self.c(n)
    }
    fn w<T: std::fmt::Display>(&mut self, v: T) {
        writeln!(self.writer, "{}", v).unwrap();
    }
    fn wn<T: std::fmt::Display>(&mut self, v: T) {
        write!(self.writer, "{}", v).unwrap();
    }
}
#[allow(dead_code)]
struct IoIter<'a: 'b, 'b, T> {
    io: &'b mut Io<'a>,
    m: std::marker::PhantomData<T>,
}
#[allow(dead_code)]
impl<'a: 'b, 'b, T> IoIter<'a, 'b, T> {
    fn new(io: &'b mut Io<'a>) -> IoIter<'a, 'b, T> {
        IoIter {
            io,
            m: std::marker::PhantomData,
        }
    }
}
impl<'a, 'b, T: FromStr> Iterator for IoIter<'a, 'b, T> {
    type Item = T;
    fn next(&mut self) -> Option<Self::Item> {
        Some(self.io.r())
    }
}
fn main() {
    let stdin = stdin();
    let stdout = stdout();
    let mut io = Io::new(&stdin, &stdout);
    unsafe {
        solve(&mut io);
    }
}
/* #endregion */

const BUF_SIZE: usize = 1024;

unsafe fn solve(io: &mut Io) {
    let a = io.ru();
    let b = io.ru();
    let n = io.ru();

    let x = min(b - 1, n);

    io.w((a * x) / b - a * (x / b));
}
//  [rust]
use proconio::*;

fn run() {
    input! {
        a: u64,
        b: u64,
        n: u64,
    }
    let x = std::cmp::min(b - 1, n);
    let ans = a * x / b - a * (x / b);
    println!("{}", ans);
}

fn main() {
    run();
}
//  [rust]
#[allow(unused_imports)]
use proconio::{fastout, input, marker::*};

#[fastout]
fn main() {
    input! {
        a: usize,
        b: usize,
        n: usize,
    }
    let mut ans = 0;
    for i in 1..n+1 {
        ans = std::cmp::max(ans, f64::floor((a * i / b) as f64) as usize - a * f64::floor((i / b) as f64) as usize);
    }

    println!("{}", ans);
}
//  [rust]
use proconio::input;

fn main() {
    input! {
        a: f64,
        b: f64,
        n: f64,
    }

    let ans = if n > b {
            floor_funtion(a, b, b-1.0)
        } else {
            floor_funtion(a, b, n)
        };
    
        println!("{}", ans as u64);

}

fn floor_funtion(a: f64, b: f64, x: f64) -> f64 {
    return (a*x/b).floor() - a * (x/b).floor();
}
//  [rust]
#![allow(unused_imports)]
#![allow(unused_variables)]

use itertools::Itertools;
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        a: usize,
        b: usize,
        n: usize,
    }
    // annotate for rust-analyzer
    let a: usize = a;
    let b: usize = b;
    let n: usize = n;

    let x = if n > b { b - 1 } else { n };
    let ans = a * x / b - a * (x / b);

    println!("{}", ans);
}
//  [swift]
let abn = readLine()!.split(separator: " ").map { Int($0)! }
let (a, b, n) = (abn[0], abn[1], abn[2])

print(a * min(n, b - 1) / b)
//  [swift]
// let (a,b,n) = cin.triple
let t = cin.triple
let a = Double(t.0)
let b = Double(t.1)
let n = t.2

let x: Double = 0
var mmax = 0

(1...n).map { Double($0) }.forEach { x in 
    let res = Int(a*x/b) - Int(a)*Int(x/b)
    // print("x: \(x) -> r: \(res)")
    mmax = max(mmax, res)
}

print(mmax)

import Foundation
#if os(Linux)
    import Glibc
#else
    import Darwin.C
#endif

enum cin {
    // 123
    static var int: Int { Int(readLine()!)! }
    // 12 23
    static var pair: (Int, Int) { let line = readLine()!.components(separatedBy: " "); return (Int(line[0])!, Int(line[1])!) }
    // 12 23 34
    static var triple: (Int, Int, Int) { let line = readLine()!.components(separatedBy: " "); return (Int(line[0])!, Int(line[1])!, Int(line[2])!) }
    // AtCoder
    static var str: String { readLine()! }
    // At Coder
    static var arrayStr: [String] { str.components(separatedBy: " ") }
    // 1 2 3 4
    static var array: [Int] { str.components(separatedBy: " ").map { Int($0)! } }
    // 1
    // 2
    // 3
    static func v_array(count: Int) -> [Int] { (0..<count).map { _ in int } }
}

extension Int {
    // 123 -> [1, 2, 3]
    var digits: [Int] { Array(String(self)).map { Int(String($0))! } }
}

extension Array where Element == Int {
    // [2, 1, 3, 2] -> 8
    var sum: Int { self.reduce(0, +) }
    // [2, 1, 3, 2] -> [1, 2, 2, 3]
    var orderBy: [Int] { sorted() }
    // [2, 1, 3, 2] -> [3, 2, 2, 1]
    var orderByDesc: [Int] { sorted(by: { $0 > $1 }) }
    // [2, 1, 3, 2] -> [2, 1, 3]
    var distinct: [Int] { Array(Set(self)) }
}

extension String {
    // e.g. cin.line.regex(match: "^(dream|dreamer|erase|eraser)*$")
    func regex(match pattern: String) -> Bool {
        let regex = try! NSRegularExpression(pattern: pattern)
        return regex.firstMatch(in: self, range: NSRange(location: 0, length: self.count)) != nil
    }
    // "ABC"[1] -> "B"
    subscript(i: Int) -> Character {
        get {
            self[index(at: i)]
        }
        set(char) {
            var characters = Array(self)
            characters[i] = char
            self = String(characters)
        }
    }
    func index(at offset: Int) -> String.Index { index(startIndex, offsetBy: offset) }
    // "ABC".swapAt(0, 1) -> "BAC"
    mutating func swapAt(_ index1: Int, _ index2: Int) {
        var characters = Array(self)
        characters.swapAt(index1, index2)
        self = String(characters)
    }
}
//  [swift]
// let (a,b,n) = cin.triple
let t = cin.triple
let a = Double(t.0)
let b = Double(t.1)
let n = Double(t.2)

let x: Double = 0
var mmax = 0

(1...10000).map { Double($0) }.forEach { x in 
    let res = Int(a*x/b) - a*Int()
    print()
}

import Foundation
#if os(Linux)
    import Glibc
#else
    import Darwin.C
#endif

enum cin {
    // 123
    static var int: Int { Int(readLine()!)! }
    // 12 23
    static var pair: (Int, Int) { let line = readLine()!.components(separatedBy: " "); return (Int(line[0])!, Int(line[1])!) }
    // 12 23 34
    static var triple: (Int, Int, Int) { let line = readLine()!.components(separatedBy: " "); return (Int(line[0])!, Int(line[1])!, Int(line[2])!) }
    // AtCoder
    static var str: String { readLine()! }
    // At Coder
    static var arrayStr: [String] { str.components(separatedBy: " ") }
    // 1 2 3 4
    static var array: [Int] { str.components(separatedBy: " ").map { Int($0)! } }
    // 1
    // 2
    // 3
    static func v_array(count: Int) -> [Int] { (0..<count).map { _ in int } }
}

extension Int {
    // 123 -> [1, 2, 3]
    var digits: [Int] { Array(String(self)).map { Int(String($0))! } }
}

extension Array where Element == Int {
    // [2, 1, 3, 2] -> 8
    var sum: Int { self.reduce(0, +) }
    // [2, 1, 3, 2] -> [1, 2, 2, 3]
    var orderBy: [Int] { sorted() }
    // [2, 1, 3, 2] -> [3, 2, 2, 1]
    var orderByDesc: [Int] { sorted(by: { $0 > $1 }) }
    // [2, 1, 3, 2] -> [2, 1, 3]
    var distinct: [Int] { Array(Set(self)) }
}

extension String {
    // e.g. cin.line.regex(match: "^(dream|dreamer|erase|eraser)*$")
    func regex(match pattern: String) -> Bool {
        let regex = try! NSRegularExpression(pattern: pattern)
        return regex.firstMatch(in: self, range: NSRange(location: 0, length: self.count)) != nil
    }
    // "ABC"[1] -> "B"
    subscript(i: Int) -> Character {
        get {
            self[index(at: i)]
        }
        set(char) {
            var characters = Array(self)
            characters[i] = char
            self = String(characters)
        }
    }
    func index(at offset: Int) -> String.Index { index(startIndex, offsetBy: offset) }
    // "ABC".swapAt(0, 1) -> "BAC"
    mutating func swapAt(_ index1: Int, _ index2: Int) {
        var characters = Array(self)
        characters.swapAt(index1, index2)
        self = String(characters)
    }
}
//  [swift]
func readInt(separator: Character) -> [Int] {
  return readLine()!.split(separator: separator).map { Int($0)! }
}
let abn = readInt(separator: " ")
let a = abn[0], b = abn[1], n = abn[2]
var maxValue = 0
var x = n
while x > 0 {
  let m = a*x / b - a * (x / b)
  let tmp = maxValue
  maxValue = max(m, maxValue)
  if tmp > maxValue { break }
  x -= 1
}
print(maxValue)
//  [typescript]
export class Main {
  static main(input: string): string {
    const tmp: string[] = input.split("\n");
    const [a, b, n]: number[] = tmp.shift().split(" ").map(int => parseInt(int));
    const x = Math.min(b - 1, n);
    return `${Math.floor(a * x / b) - a * Math.floor(x / b)}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));
//  [typescript]
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
const [a, b, n] = input[0].split(" ").map((x: string): number => +x);

const x = n < b ? n : b - 1;
console.log(Math.floor(x * a / b));
//  [typescript]
import * as fs from 'fs'
import {debug} from '../../../util'

const input = fs.readFileSync('/dev/stdin', 'utf8').split(' ').map(n => parseInt(n, 10))
const output = (x: any) => console.log(x)
// debug(input)
const [A, B, N] = input

const x = N < B ? N : B - 1
// debug(x)

const sum = Math.floor(A / B * x) - A * Math.floor(x / B)
output(sum)
//  [typescript]
import * as fs from 'fs'
import {debug} from '../../../util'

const input = fs.readFileSync('/dev/stdin', 'utf8').split(' ').map(n => parseInt(n, 10))
const output = (x: any) => console.log(x)
// debug(input)
const [A, B, N] = input

const x = N <= B ? N : B - 1
// debug(x)

const sum = Math.floor(A / B * x) - A * Math.floor(x / B)
output(sum)
//  [typescript]
import * as fs from 'fs'
import {debug} from '../../../util'

const input = fs.readFileSync('/dev/stdin', 'utf8').split(' ').map(n => parseInt(n, 10))
const output = (x: any) => console.log(x)
// debug(input)
const [A, B, N] = input

let x = B
for(let i = N; i >= 1; --i) {
    if (i < B) {
        x = i
        break
    }
}
// debug(x)

const sum = Math.floor(A / B * x) - A * Math.floor(x / B)
output(sum)
//  [typescript]
import * as fs from 'fs'

const input = (fs.readFileSync('/dev/stdin', 'utf8') as string).split('\n')
const [a, b, n] = input[0].split(' ').map((x: string): number => +x)

const result = [...new Array(n + 1)]
  .map((_, i) => Math.floor((i * a) / b) - a * Math.floor(i / b))
  .reduce((a, b) => Math.max(a, b))

console.log(result)
//  [python]
n,i=map(int,input().split())
print(n-i+1)
//  [python]
print(eval(input().replace(" ","-"))+1)
//  [python]
N, i = map(int, input().split())
print(N - i + 1)
//  [python]
print(1 - eval(input().replace(" ", "-")))
//  [python]
n,i=map(int,input().split())
print(n-i)
//  [python]
a,b=input().split()
print(int(a-b+1))
//  [java]
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int n = Integer.parseInt(str[0]);
    int i = Integer.parseInt(str[1]);
    System.out.println(n-i+1);
  }
}
//  [java]
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main
{

  public static void main
  (
    String[] args
  )
  {
    BufferedReader in_stream;
    String         in_str;
    String[]       in_str_split;

    int in_N;
    int in_i;

    int ans;

    try
    {
      in_stream = new BufferedReader(new InputStreamReader(System.in));

      /*----------------
       * 引数
       *----------------*/
      in_str       = new String(in_stream.readLine());
      in_str_split = in_str.split(" ");
      in_N         = Integer.parseInt(in_str_split[0]);
      in_i         = Integer.parseInt(in_str_split[1]);

      /*----------------
       * 計算
       *----------------*/
      ans = in_N - in_i + 1;

      System.out.println(String.valueOf(ans));
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
  }
}
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
	boolean eof;

	void solve() throws IOException {
		int n = nextInt();
		int i = nextInt();
		out.println(n - i + 1);
	}

	Main() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		new Main();
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return null;
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			eof = true;
			return null;
		}
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}
//  [java]
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
      ArrayList<Integer> one = nextintArray();
      int N = one.get(0);
      int x = one.get(1);
      myout(N - x + 1);
	}
	//Method addition frame start



	//Method addition frame end
}
//  [java]
mport java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int i = sc.nextInt();
		sc.close();

		System.out.println(n + 1 - i);
	}
}
//  [java]
import java.util.*;
public class Main {
	public static void main(String[] args) throws Exception{
      Scanner scn = new Scanner(System.in);
      int h = scn.nextInt();
      int w = scn.nextInt();
      char[][] a = new char[h][w];
      for(int i=0; i<h; ++i){
        String str = scn.next();
        for(int j=0; j<w; ++j){
          a[i][j] = str.charAt(j);
        }
      }
      int[] hh = new int[h];
      int c = 0;
      for(int i=0; i<h; ++i){
        int count = 0;
        for(int j=0; j<w; ++j){
          if(a[i][j]=='.'){
            count = count + 1;
          }
        }
          if(count != w){
          	hh[c] = i;
            c = c + 1;
          }
      }
      int[] ww = new int[w];
      int d=0;
      for(int j=0; j<w; ++j){
        int count = 0;
        for(int i=0; i<h; ++i){
          if(a[i][j]=='.'){
            count = count + 1;
          }
        }
          if(count != h){
          	ww[d] = j;
            d = d + 1;
          }
      }
      for(int i=0; i<c; ++i){
        for(int j=0; j<d; ++j){
        	System.out.print(a[hh[i]][ww[j]]);
        	System.out.println();
        }
      }
    }
}
//  [cpp]
#include<stdio.h>

int main(void){
int n,i;
int c;
scanf("%d%d",&n,&i);
c=n-i+1;
printf("%d\n",c);

return 0;}
//  [cpp]
#include <iostream>
using namespace std;
int main(){
 
  int n,m;
  cin>>n>>m;
  
  cout<<n-m+1<<endl;
  
}
//  [cpp]
#include <iostream>
using namespace std;

int main(int argc, char *argv[])
{
    int a, b;
	cin >> a >> b;

	cout << (a - b) + 1;

	return 0;
}
//  [cpp]
#include <iostream>
#include <algorithm>
using namespace std;


int main()
{
	int n, i;
	cin >> n >> i;
	cout << n - i + 1;1
}
//  [cpp]
#include<iostream>
using namespace std;
int main (){
 int N,i,z;
 cin>>N>>i;
			  for(int x=N;x>=0;x--) 
			 {
			 	if(x>=i)
			 	z++;
			 	else
			 	break;
			 }	
			 cout<<z<<endl;
			 return 0; 
}
//  [cpp]
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;
#define rep(n) for( int i = 0 ; i < n ; i++ )
#define REP(n) for( int i = 1 ; i <= n ; i++ )
#define repll(n) for( ll i = 0 ; i < n ; i++ )
#define REPll(n) for( ll i = 1 ; i <= n ; i++ )
#define rep2(n) for( int j = 0 ; j < n ; j++ )
#define REP2(n) for( int j = 1 ; j <= n ; j++ )
#define repll2(n) for( ll j = 0 ; j < n ; j++ )
#define REPll2(n) for( ll j = 1 ; j <= n ; j++ )

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a , b;
  	cin >> a;
  	cout << a - b + 1;
}
//  [c]
#include <stdio.h>
int main(void){

    int a, b;
    int result;
    
    scanf("%d %d", &a, &b);
    
    result=a-b+1;
    
    printf("%d\n", result);
    
    return 0;
}
//  [c]
#include <stdio.h>

int main(){
int n,i;
scanf("%d %d",&n,&i);
printf("%d",n - i + 1);
return 0;
}
//  [c]
i;main(n){scanf("%d%d",&n,&i);printf("%d",n-i+1);}
//  [c]
/* ex5_3
   tamayama */

#include<stdio.h>
#define SIZE 100

int main(void){
    int table_height,table_width;
    char table[SIZE][SIZE];
    int i,j,k,l,m,n,x,y;
    int count = 0;

    scanf("%d %d",&table_height,&table_width);   /*.や#を入力する*/
    for(i=0;i<table_height;i++){
        for(j=0;j<table_width;j++){
            scanf(" %c",&table[i][j]);
        }
    }
    for(i=0;i<table_height;i++){    /*.のみの行をxに変換する*/
        for(j=0;j<table_width;j++){
            if(table[i][j] == '.'){
                count++;
                if(count == table_width){
                    for(k=0;k<table_width;k++){
                        table[i][k] = 'x';
                    }
                }
            }
        }count = 0;
    }
    for(l=0;l<table_width;l++){    /*.またはxの行をxに変換する*/
        for(m=0;m<table_height;m++){
            if(table[m][l] == '.' || table[m][l] == 'x'){
                count++;
                if(count == table_height){
                    for(n=0;n<table_height;n++){
                        table[n][l] = 'x';
                    }
                }
            }
        }count = 0;
    }

    for(x=0;x<table_height;x++){    /*xを無視して出力する*/
        for(y=0;y<table_width;y++){
            if(table[x][y] != 'x'){
            printf("%c",table[x][y]);
            }
        }
        printf("\n");
    }
    return 0;
}
//  [c]
/*  ex4_4
    potter0723sw  */

#include <stdio.h>
#include <stdlib.h>

void werase(int *ptr, int *last, int eraser);//ptrは削除位置、lastは末尾位置、eraserは消す行の文字数
void erase(int *ptr, int *last);

int main(void){
    int height, width, i, j;
    char cell[10001];
    scanf("%d %d", &height, &width);

    for(i=0; i < height; i++){//マスの入力を受け取る
        for(j=0; j < width; j++){
            scanf("　%c", &cell[i*height+j]);
        }
    }

    for(i=0; i < height; i++){
        for(j=0; j < width; j++){
            if(cell[i * height+j] == '#'){//黒マス発見でループ脱出
                break;
            }
            if(j == width - 1){//最後のマスまで白なら行削除
                werase((int *)(1+ i * width),(int *)(width * height),width);
                height = height - 1;
            }
        }
    }

    for(j=0; j < width; j++){
        for(i=0; i < height; i++){
            if(cell[i * height+j] == '#'){//黒マス発見でループ脱出
                break;
            }
            if(j == height - 1){//最後のマスまで白なら行削除
                for(i=0; i < height; i++){
                    erase((int *)(1+ i * width + j),(int *)(width * height));
                }
                width = width - 1;
            }
        }
    }

    for(i=0; i < height; i++){
        for(j=0; j < height; j++){
            printf("%c", cell[i * height+j]);
        }
        printf("\n");
    }
}

void werase(int *wptr, int *wlast, int eraser){
    while(++wptr < wlast){
        *(wptr - eraser) = *wptr;//要素をひとつ前にずらす
    }
}

void erase(int *ptr, int *last){
    while(++ptr < last){
        *(ptr - 1) = *last;
    }
}
//  [c]
#include<stdio.h>
int main(void){
  int ab;
  scanf("%d%d",&a,&b);
  printf("%d",a-b+1);
  return 0;
}
//  [javascript]
function main(input) {
  var args = input.split(" ");
  var n = parseInt(args[0], 10);
  var i = parseInt(args[1], 10);
  console.log(n - i + 1);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
    i = input.split(" ");
    console.log(i[0] - i[1] + 1);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input) {
  var N = input[0].split(" ")[0];
  var i = input[0].split(" ")[1];
  console.log(N-i+1);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))
//  [javascript]
const main = (arg) => {
  const lines = arg.trim().split('\n');
  const [N, i] = lines[0].map(Number);
  console.log(N - i + 1);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
'use strict'
const main = argv => {
  onst input = argv.split(' ').map(value => parseInt(value))
  console.log(input[0] + 1 - input[1])
}

main(require("fs").readFileSync("/dev/stdin", "utf8"))
//  [javascript]
'use strict'
const main = argv => {
  onst input = argv.split(' ').map(value => Number(value))
  console.log(input[0] + 1 - input[1])
}

main(require("fs").readFileSync("/dev/stdin", "utf8"))
//  [go]
package main

import (
  "fmt"
)

func main() {
  var n, i int
  fmt.Scan(&n, &i)
  fmt.Println(n - i + 1)
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var n, i int
	fmt.Scan(&n, &i)

	fmt.Println(n - i + 1)
}
//  [go]
package main

import "fmt"

func main() {
	var n, i int
	fmt.Scan(&n, &i)
	fmt.Println(n-i+1)
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var n, i int
	fmt.Println(n - i + 1)
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var N, i int

	ans := N - i + 1

	fmt.Println(ans)
}
//  [go]
package main

import "fmt"

func main() {
	var i int
	fmt.Scan(&i)
	fmt.Println(101 - i)
}
//  [ruby]
a,b = gets.split.map(&:to_i)
puts a-b+1
//  [ruby]
n,i=gets.split.map(&:to_i);p (n + 1) - i
//  [ruby]
# abc107 A
n, i = gets.split.map(&:to_i)
p n - i + 1
//  [ruby]
a,b=gets.split.map &:to_i
puts b-a+1
//  [ruby]

def main():
    n,i = map(int,input().split())
    print(n-i+1)

if __name__ == '__main__':
    main()
//  [ruby]
N = get.chomp.to_s
n = get.chomp.to_s

puts "N - n"
//  [rust]
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: usize = read();
    let b: usize = read();
    println!("{}", a - b + 1);
}
//  [rust]
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let n = v[0];
	let i = v[1];
	println!("{}", n - i + 1);
}
//  [rust]
use std::io::Read;

fn main() {
    let mut buf = String::new();

    std::io::stdin().read_to_string(&mut buf).unwrap();

    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();    
    let i: usize = iter.next().unwrap().parse().unwrap();    
    println!("{}", n - i + 1);
}
//  [rust]
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: usize = read();
    let b: usize = read();
    println!("{}", a - b + 1);
}
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: usize = read();
    let b: usize = read();
    println!("{}", a - b + 1);
}
//  [rust]
macro_rules! get {
      ($t:ty) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.trim().parse::<$t>().unwrap()
          }
      };
      ($($t:ty),*) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              let mut iter = line.split_whitespace();
              (
                  $(iter.next().unwrap().parse::<$t>().unwrap(),)*
              )
          }
      };
      ($t:ty; $n:expr) => {
          (0..$n).map(|_|
              get!($t)
          ).collect::<Vec<_>>()
      };
      ($($t:ty),*; $n:expr) => {
          (0..$n).map(|_|
              get!($($t),*)
          ).collect::<Vec<_>>()
      };
      ($t:ty ;;) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.split_whitespace()
                  .map(|t| t.parse::<$t>().unwrap())
                  .collect::<Vec<_>>()
          }
      };
      ($t:ty ;; $n:expr) => {
          (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
      };
}

fn main() {
    // 入力
    let N = get!(i64);
    let p = get!(i64; N);

    let ans = p.iter().fold(0, |sum, a| sum + a.count);

    // 出力
    println!("{}", ans);
}
//  [rust]
//
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
//
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

//
// solution 
//

#[allow(unused_mut)]
#[allow(non_snake_case)]
use std::cmp;
fn main() {
    input!{
        N: usize,
        K: usize,
        x: [i64; N],
    }
    
    let mut dis = std::i64::MAX;
    if x[0] >= 0 {
        println!("{}", x[K-1]); 
        return
    } else if x[N-1] < 0 {
        println!("{}", x[N-K]);
        return
    } for start_ind in 0..(N-K) {
        if x[start_ind] <= 0 && x[start_ind+K-1] >= 0 {
            let distance = cmp::min(x[start_ind].abs(), x[start_ind+K-1]) 
                + x[start_ind+K-1] - x[start_ind];
            dis = cmp::min(dis, distance);
        }
    }

    println!("{}", dis);
}
//  [swift]
let i=readLine()!.characters.split(" ").map{Int(String($0))!};print(i[0]-i[1]+1)
//  [swift]
import Foundation
 
let input_line: String = readLine()!
let split: [String] = input_line.components(separatedBy: " ")
 
let N = Int(split[0])!
let i = Int(split[1])!

print(N-i+1)
//  [swift]
print(readLine()!.characters.split(" ").reduce(1){$0-Int(String($1))!})
//  [swift]
print(readLine()!.characters.reduce(1){$0-Int(String($1))!})
//  [swift]
print(readLine()!.reduce(1){$0-Int($1)!})
//  [typescript]
const main = (input) => {
  input = input.split(' ');
  const N = parseInt(input[0], 10);
  const i = parseInt(input[1], 10);
  
  console.log(N+1-i);
  
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[])=>{for(let i=0;i<a.length;i+=2)if(s==a[i])return a[i+1]};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};
const main = ()=>{
  let [a,b]=nrin(2);
  out(a-(b-1));
}
main();
//  [typescript]
function main(input) {
  var a = input.split(/\n|\s/g).map(v=>parseInt(v,10));
    console.log(a[0]-a[1]+1);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
{
	const process = (a: string[]) => {
		const length = parseInt(a[0])
		const fromFirst = parseInt(a[1])
		return length - fromFirst + 1
	}

	const Main = (input: string): void => {
		//const num = parseInt(input)
		const ary = input.split(" ")
		console.log(process(ary))
	}

	Main("4 2") // => 3
	Main("1 1") // => 1
	Main("15 11") // => 5
	//Main(require("fs").readFileSync("/dev/stdin", "utf8"))
}
//  [python]
N, Blue, Red = map(int, input().split())

if(Blue >= N):
    print(N)
elif (Blue + Red) >= N or Blue == 0:
    print(Blue)
else:
    q = N // (Blue + Red)
    mod = N % (Blue + Red)
    if Blue < mod:
        print(q * Blue  + Blue)
    else:
        print(q * Blue + mod)
//  [python]
n, a, b = map(int, input().split())
times = n // (a + b)
r = n % (a + b)

print(times * a + min(r, a))
//  [python]
base = input().split()
n = int(base[0])
a = int(base[1])
b = int(base[2])
block = a+b
blockcnt = n//block
partx =a*blockcnt
ans = 0
if a>=(n%block):
    ans = partx+(n%block)
else:
    ans = partx+a
print(ans)
//  [python]
n,a,b = list(map(int,input().split()))
k = int(n/(a+b))
l = n%(a+b)
k *=a
if l<b:
    k+=l
else:
    k+=a
print(k)
//  [python]
N, A, B = map(int, input().split())
# 先頭からN個のボール, 列の末尾にA個の青ボール追加, B個の赤ボール追加

count = A * N // (A + B)
count += min(N - count, A)
print(count)
//  [python]
n, a, b = map(int, input().split())
s = ''
for _ in range(a):
    s += 'a'
for _ in range(b):
    s += 'b'

s *= 1000

print(s[0:n].count('a'))
//  [java]
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		long n = saori.saorihayami();
		long a = saori.saorihayami();
		long b = saori.saorihayami();
		long ans = 0;
		long num = n%(a+b);
		long num2 = n/(a+b);
		if(num == 0){
			ans = num2*a;
		} else if(num2 > 0){
			ans = num2 * a;
			if(num >= a){
				ans += a;
			} else {
				ans = ans + num;
			}
		} else {
			if(n >= a){
				ans = a;
			} else {
				ans = n;
			}
		}
		System.out.println(ans);
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}
//  [java]
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class Main {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve() {
		long N = nl(), A = nl(), B = nl();
		long ans = N / (A + B) * A + Math.min(N % (A + B), A);
     	out.println(ans);
	}

	void run() throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if (!INPUT.isEmpty())
			tr(System.currentTimeMillis() - s + "ms");
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private static void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}
//  [java]
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static void main(String[] args) throws Exception {
		solution(args);
		if(in!=null){
			in.close();
		}
	}

	public static void solution(String[] args) throws Exception{
		long N = nextLong();
		long A =nextLong();
		long B =nextLong();

		long ans =(N/(A+B))*A+Math.min(N%(A+B), A);
		System.out.println(ans);

	}





	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}

}
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        MyReader reader = new MyReader();
        int n = reader.readInt();
        int a = reader.readInt();
        int b = reader.readInt();
        System.out.println(problem158b(n, a, b));
    }

    private static int problem158b(int n, int a, int b) {
        int ab = a + b;
        if (a == 0 || ab == 0) return 0;
        return a * (n / ab) + (Math.min(a, (n % ab)));
    }

    private static class MyReader {
        private final BufferedReader br;
        private MyReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        
        private String readString() throws IOException {
            return br.readLine();
        }

        private int readInt() throws IOException {
            return br.read();
        }

        private String[] readStrings(String regex) throws IOException {
            return readString().split(regex);
        }

        private int[] readInts(String regex) throws IOException {
            String[] strings = readStrings(regex);
            int[] ints = new int[strings.length];
            for (int i = 0; i < ints.length; i++) {
                ints[i] = Integer.parseInt(strings[i]);
            }
            return ints;
        }
    }
}
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        MyReader reader = new MyReader();
        int[] nab = reader.readInts(" ");
        int n = nab[0];
        int a = nab[1];
        int b = nab[2];
        System.out.println(problem158b(n, a, b));
    }

    private static int problem158b(int n, int a, int b) {
        int ab = a + b;
        if (a == 0 || ab == 0) return 0;
        int res1 = (n / ab);
        int res2 = (n % ab);
        return a * res1 + ((a > res2) ? res1 : a);
    }

    private static class MyReader {
        private final BufferedReader br;
        private MyReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        private String readString() throws IOException {
            return br.readLine();
        }

        private int readInt() throws IOException {
            return Integer.parseInt(readString());
        }

        private String[] readStrings(String regex) throws IOException {
            return readString().split(regex);
        }

        private int[] readInts(String regex) throws IOException {
            String[] strings = readStrings(regex);
            int[] ints = new int[strings.length];
            for (int i = 0; i < ints.length; i++) {
                ints[i] = Integer.parseInt(strings[i]);
            }
            return ints;
        }
    }
}