jiahuimbzuai/CoQuIR huggingface dataset:
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 
const int mod=1e9+7;
 
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};
 
mint c[4005][4005];
void init() {
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i+1][j] += c[i][j];
      c[i+1][j+1] += c[i][j];
    }
  }
}
mint comb(int n, int k) {
  return c[n][k];
}
 
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
 
    return true;
}
 
map<ll, ll> primeFact(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
  return res;
}
 
void printv(vi& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
void printv(vll& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}
 
int main()
{
  //init(); // mint初期化
  cin.tie( 0 );
  ios::sync_with_stdio( false );
 
  int n,i;
  cin>>n>>i;
  cout(n-i+1);
  return 0;
}
//  [cpp]
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <vector>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int n,k,ans=0;
  cin>>n>>k;
  ans=n-k+1;
  cout<<ans<<"\n";
  return 0;
}
//  [c]
#include<stdio.h>
int main(void)
{ 
   int n,i,s=0;
   scanf("%d%d",&n,&i);
   s=n+1-i;
   printf("%d",s);
   return 0;
}
//  [c]
 #include<stdio.h>
 int main(void)
 {
     int N,i;

     scanf("%d%d",&N,&i);

     printf("%d\n",N-i+1);

     return 0;
 }
//  [c]
#include <stdio.h>

int main(void)
{
        int n,i;
        scanf("%d%d",&n,&i);
        printf("%d\n",n-i+1);
        return 0;
}
//  [javascript]
var toInt = x=>parseInt(x,10);
var toIntArr = arr=>arr.map(x=>toInt(x));
var abs = x=>x>0?x:-x;
function min(){var rest = arguments,val=rest[0];for(var i=1;i<rest.length;i++)if(rest[i]<val)val = rest[i];return val}
function max(){var rest = arguments,val=rest[0];for(var i=1;i<rest.length;i++)if(rest[i]>val)val = rest[i];return val}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
 
function Main(input){
	var input = input.split(' ');
	var n = toInt(input[0]);
	var i = toInt(input[1]);
	var ans = n+1-i;
	
	console.log(ans);
}
//  [javascript]
function main(arg){
    arg = arg.split("\n")
    arg  =arg[0].split(" ")
    console.log(parseInt(arg[0])+1 - parseInt(arg[1]))
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
'use strict';

function main(input) {
    const args = input.split(' ');
    const i = parseInt(args[0], 10);
    const x = parseInt(args[1], 10);

    console.log(i - x + 1);
};

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

import (
	"bufio"
	"fmt"
	//"math"
	"os"
	"strconv"
	"strings"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	s, _ := r.ReadString('\n')
	s = strings.TrimRight(s, " \t\n")
	slice := strings.Split(s, " ")
	n := string(slice[0])
	i := string(slice[1])
	N, _ := strconv.Atoi(n)
	I, _ := strconv.Atoi(i)

	fmt.Println(N + 1 - I)
}
//  [ruby]
n,i = gets.chomp.split(' ').map(&:to_i)
puts n - i + 1
//  [ruby]
a,b=gets.split.map &:to_i
puts a-b+1
//  [ruby]
n,i = gets.chomp.split(' ').map(&:to_i)
puts n-i+1
//  [rust]
use text_io::*;
use std::collections::HashMap;
use std::process::exit;

fn main() {
    let n:usize = read!();
    let m:usize = read!();
    println!("{}",n-m+1)
}
//  [rust]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;

fn main() {
    input! {
    n: usize,
    i: usize,
    }
    let ans = n + 1 - i;
    println!("{}", ans);
}
//  [rust]
use proconio::{input, fastout};

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
  }

#[fastout]
fn main() {
    input!{
        n: usize,
        i: usize,
    }

    println!("{}", n-i+1);

}
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [N, i] = input[0].map(Number);

  return N - i + 1;
};

console.log(main(read()));
//  [typescript]
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8')

const [n, i] = stdin.split('\n')[0].split(' ').map(Number)

console.log(n-i+1)
//  [typescript]
import * as fs from 'fs';

namespace AtCoder.abc007 {

    class Program {
        /**
         * in
         *  4 2
         * out
         *  3
         */
        main(inp: string): void {
            const [n,i] :number[] = inp.split(' ').map(Number);
            console.log(n-i+1);
        } 
    }

    const prg = new Program();
    prg.main(fs.readFileSync('/dev/stdin', 'utf8').trim());
}
//  [python]
import sys
A, B, C = map(int, raw_input().split())
for i in range(1, B + 1):
    if (i * A) % B == C:
        print "YES"
        sys.exit(0)
print "NO"
//  [python]
A, B, C = map(int, input().split())

def Choose(A, B, C):
    if A == 1:
        return 'YES'
    for i in range(B):
        if C == (A * i) % B:
            return 'YES'
    return 'NO'

print(Choose(A, B, C))
//  [python]
a,b,c = map(int,input().split())
r = False
for i in range(1,b+1):
  if (a*i)%b==c:
    r =True
print('YES' if r else 'NO')
//  [python]
a, b, c = map(int, input().split())
for i in range(1,10000000):
    if a*i % b == c:
        print("YES")
        exit()
print("NO")
//  [python]
import sys
A, B, C = map(int, input().split())
for k in range(10000000):
  if (k * A) % B == C:
    print("YES")
    sys.exit(0)
print("NO");
//  [python]
a, b, c = map(int, input().split())

# n*a /b >
if (a % 2 == 0 and b % 2 == 0 and c % 2 != 0):
    print('NO')
elif (a % 2 == 0 and b % 2 != 0 and c % 2 == 0):
    print('NO')


else:
    count = 0
    while count < 10 ** 7:
        count += 1
        if ((a * count) % b == c):
            print('YES')
            exit()

    print('NO')
//  [java]
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] ss0 = br.readLine().trim().split(" ", 0);
		int a = Integer.parseInt(ss0[0]);
		int b = Integer.parseInt(ss0[1]);
		int c = Integer.parseInt(ss0[2]);
		
		
		for(int i=0; i<b; i++) {
			if( (a*i)%b == c ) {
				System.out.println("YES");
				return;
			}
		}
		
		
		
		
        //System.out.println(s[0].charAt(s[0].length()-1));
        System.out.println("NO");
        return;
    }
    //-----------------------------------------------------------------
    // Debug.Print
    static void dp(String s) {
		System.out.println(s);
	}
    static void dp(StringBuilder s) { dp(s.toString()); }
    static void dp(int i) { dp(String.valueOf(i)); }
    static void dp(long i) { dp(String.valueOf(i)); }


	//-----------------------------------------------------------------
	// 入力値確認：リスト
	static void checkInput(List l) { System.out.println(l); }
	//-----------------------------------------------------------------
	// 入力値確認：配列、1次元、float型
	//   ＜使い方＞
	//     float[] f = new float[N];
	//     checkInput(f);
	static void checkInput(float[] i1) {
		StringBuilder sb = new StringBuilder();
		for(float i: i1) sb.append("[" + i + "]");
		System.out.println(sb);
	}
	//-----------------------------------------------------------------
	// 入力値確認：配列、1次元、int型
	//   ＜使い方＞
	//     int[] c = new int[N];
	//     checkInput(c);
	static void checkInput(int[] i1) {
		StringBuilder sb = new StringBuilder();
		for(int i: i1) sb.append("[" + i + "]");
		System.out.println(sb);
	}
	//-----------------------------------------------------------------
	// 入力値確認：配列、二次元、int型
	static void checkInput(int[][] i2) {
		StringBuilder sb = new StringBuilder();
		for(int[] i1: i2){
			for(int i: i1) sb.append("[" + i + "]");
			sb.append(System.getProperty("line.separator"));
		}
		System.out.println(sb);
	}
	//-----------------------------------------------------------------
	// 入力値確認：配列、二次元、int型
	static void checkInput(long[][] i2) {
		StringBuilder sb = new StringBuilder();
		for(long[] i1: i2){
			for(long i: i1) sb.append("[" + i + "]");
			sb.append(System.getProperty("line.separator"));
		}
		System.out.println(sb);
	}

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

public class Main {
	private BufferedReader br;
	private long a,b,c;
	private StringTokenizer st;
	private boolean Istrue;

	public static void main(String[] args) throws IOException{
		// TODO Auto-generated method stub
		new Main().start();
	}
	private void start() throws IOException{
		br=new BufferedReader(new InputStreamReader(System.in));
		st=new StringTokenizer(br.readLine());
		a=Integer.parseInt(st.nextToken());
		b=Integer.parseInt(st.nextToken());
		c=Integer.parseInt(st.nextToken());
		Istrue=false;
		for(long i=1;i<b;i++){
			if((a*i)%b==c){
				Istrue=true;
				break;
			}
		}
		if(Istrue){
			System.out.println("YES");
		}
		else{
			System.out.println("NO");
		}
	}
}
//  [java]
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		long a = stdIn.nextLong();
		long b = stdIn.nextLong();
		long c = stdIn.nextLong();
		
		for(int i = 0; i < (int)1e8; i++) {
			if((b*i+c)/a == (b*i+c)/(double)a) {
				System.out.println("YES");
				return;
			}
		}
		System.out.println("NO");
		
	}

}
//  [java]
import java.util.*;

public class Main {
	public static void main(String[] args){
	Scanner scn = new Scanner(System.in);
	int a = scn.nextInt();
      int b = scn.nextInt();
      int c = scn.nextInt();
      int check = 0;
      long x = (long)(5*Math.pow(10,7));
      for(long i=0; i<x; ++i){
        if((a*i) % b == c){
          check =1;
        }
      }
      if(check==0){
        System.out.println("NO");
      }
      if(check==1){
        System.out.println("YES");
      }
	}
}
//  [java]
import javax.net.ssl.SSLContext;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Stack;

public class Main {

    private static long gcd(long a, long b)
    {
        while (b > 0)
        {
            long temp = b;
            b = a % b; // % is remainder
            a = temp;
        }
        return a;
    }

    private static long lcm(long a, long b)
    {
        return a * (b / gcd(a, b));
    }

    private static long lcm(long[] input)
    {
        long result = input[0];
        for(int i = 1; i < input.length; i++) result = lcm(result, input[i]);
        return result;
    }


    public static void main(String[] args) throws IOException {

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String[] input = reader.readLine().split(" ");
        int a = Integer.parseInt(input[0]);
        BigDecimal b = new BigDecimal(Integer.parseInt(input[1]));
        BigDecimal c = new BigDecimal(Integer.parseInt(input[2]));

        for (int x = 1; x <= 100000; x++) {
            BigDecimal ax = new BigDecimal(a*x);
            BigDecimal remain = ax.divideAndRemainder(b)[1];
            if (remain.compareTo(c) == 0) {
                System.out.print("YES");
                return;
            }
        }

        System.out.println("NO");



//        PrintWriter writer = new PrintWriter(System.out);
//
//        writer.close();


    }
}
//  [cpp]
#include<cstdio>
int check(int a,int b,int c)
{
	for(int i=1;i<=b;i++)
	if((a*i+c)%b==0) return 1;
	return 0;
}
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(check(a,b,b-c)) printf("YES\n");
	else printf("NO\n");
	return 0;
}
//  [cpp]
#include<cstdio>
#include<cmath>

using namespace std;

int main()
{
	int a,b,c;
	int i,n,flag;
	long long sum;
	while(~scanf("%d %d %d",&a,&b,&c))
	{
		flag=0;
		n = c % b;
		for(i = 0;i < 1000;i++)
		{
			sum = (i + 1) * a;
			if(sum % b == n)
			{
				flag=1;
				break;
			}
		}
		if(flag==1)
			printf("YES\n");
		if(flag==0)
			printf("NO\n");
	}
	return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(v) v.begin(), v.end()
#define allg(v) v.begin(), v.end(), greater<int>()



signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s;
  int a, b, c;
  cin >> a >> b >> c;
  bool ans = false;
  
  for(int i = 1; i <= 180000000; i++) {
    if((i*a) %b == c) {
      ans = true;
      break;
    }
  }  
  
  cout << ( ans ?"YES" :"NO") << "\n";
  
}
//  [cpp]
#include<iostream>
#include<vector>
#include<algorithm>

#define REP(n) for(int i = 0;i < n;i++)
typedef long long int ll;
using namespace std;
#define MAX_A 100005

int main(){

    int a,b,c,tmp;
    cin >> a >> b >> c;
    //cout << a << b << c << endl;
    tmp = a;

    for(int i = 1;i < a*b;i++){
        if(a%b == c){
            cout << "YES" << endl;
            return 0;
        }else{
            a+=tmp;
            //cout << a << endl;
        }
    }
    cout << "NO" << endl;
    return 0;
}
//  [c]
#include <stdio.h>


int main()
{
    int a, b, c;
    
    scanf("%d %d %d", &a, &b, &c);

    for (int i = 1; i <= b; i++)
    {
	if ((a * i) % b == c)
	{
	    printf("YES\n");

	    return 0;
	}
    }
    printf("NO\n");

    return 0;
}
//  [c]
#include <stdio.h>
int main(void){
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	int i;
	for(i=1;i<b;i++){
		int x=a*i,r=x%b;
		if(r==c){printf("YES");return 0;}
	}
	printf("NO");
	return 0;
}
//  [c]
#include<stdio.h>
int main(){
int A,B,C,i;
scanf("%d%d%d",&A,&B,&C);
for(i=0;i<B;i++){
  if(A*(i+1) % B==C){
  printf("YES\n");
  break;
  }
if(i==B-1) printf("NO\n");
}
return 0;
}
//  [c]
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<limits.h>
#include<math.h>
#include<time.h>


int main(void){
    int A, B, C;
    scanf("%d %d %d", &A, &B, &C);

    int i = 1;
    time_t start = time(NULL);
    while(1) {
        if(i*A % B == C) {
            printf("YES\n");
            return 0;
        }
        if(time(NULL) - start > 0.0001) {
          printf("NO\n");
          return 0;
        }
        i++;
    }
    return 0;
}
//  [c]
#include <stdio.h>
int main() {
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	for (int i = 1; i <= 1e7; i++) {
		if ((a * i) % b == c) {
			printf("YES\n");
			return 0;
		}
	}
	printf("NO\n");
	return 0;
}
//  [javascript]
'use strict';
function Main(stdin){
  const input = stdin.trim().split(' ').map(str => Number(str));
  const A = input[0], B = input[1], C = input[2];
  let result = 'NO';
  for(let i = 1; i <= 100; i++){
    if((A*i)%B === C){
        result = 'YES';
        break;
    }
  }
  console.log(result);
}

// 固定
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
"use strict";
    
const main = arg => {
    arg = arg.split("\n")[0].split(" ");
    const A = arg[0];
    const B = arg[1];
    const C = arg[2];
    
    let flg = false;
    
    for(let i=0; i<B; i++) {
        if((A * i - C) % B === 0) {
            flg = true;
        }
    }
    
    console.log(flg ? "YES" : "NO");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function Main(s) {
  var s = s.split("\n")[0].split(" ").map(e => e*1);
  var backet = new Array(s[1]).fill(0);
  var check = s[0] % s[1], a = s[0];
  backet[check] = 1;
  while(backet[check] < 2) {
    s[0] += a;
    check = s[0] % s[1];
    backet[check]++;
  }
  console.log(backet[s[2]] >= 1 ? "YES":"NO");
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict'

main()

function main (input) {
  readInput()
  .then(parseInput)
  .then(calc)
}

function calc (input) {
  let a = input[0]
  let b = input[1]
  let c = input[2]
  let ok = false
  for (let n = 1; n <= b; n++) {
    if ((n * a) % b === c) {
      ok = true
    }
  }
  let answer = ok ? 'YES' : 'NO'
  console.log(answer)
}

function parseInput (inputRaw) {
  let input = inputRaw.split(' ').map(Number)
  return input
}

function readInput () {
  return new Promise((resolve) => {
    let inputArr = []
    process.stdin.resume()
    process.stdin.setEncoding('utf8')
    process.stdin.on('data', (chunk) => {
      inputArr.push(chunk)
    })
    process.stdin.on('end', () => {
      let input = inputArr.join('').trim()
      resolve(input)
    })
  })
}
//  [javascript]
const main = stdin => {
  const input = stdin.trim().split('\n')
  const [A, B, C] = input[0].split(' ').map(x => parseInt(x))

  for (let i = A; i <= 10000; i += A) {
    if (i % B === C) {
      console.log('YES')
      return
    }
  }
  console.log('NO')
}


// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
    input = input.split("\n");
    var line = input[0].split(" ");
    var base = parseInt(line[0]);
    var waru = parseInt(line[1]);
    var amari = parseInt(line[2]);
    var flag = 0;
    var arrAmariall = [];
    for(var i = 0; i<100; i++){
        arrAmariall.push(base*i%waru);
    }
    
    for(var i = 0; i<100; i++){
        if(amari === arrAmariall[i]){
            flag++;
        }
    }
    
    if(flag>=1){
        console.log("YES");
    } else {
        console.log("NO");
    }
//    console.log(line[0].charAt(line[0].length));
//    console.log(line[1].charAt(line[1].length));
//    console.log(line[2].charAt(line[2].length));
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

func (con *contest) gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b > 0 {
		a, b = b, a%b
	}
	return a
}

func (con *contest) main() error {
	var a, b, c int
	con.Scan(&a, &b, &c)
	if c%con.gcd(a, b) == 0 {
		con.Println("YES")
	} else {
		con.Println("NO")
	}
	return nil
}

// X * A = Y * B + C
//  [go]
package main

import "fmt"

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

	for i := 1; i <= a*b; i++ {
		if i*a%b == c {
			fmt.Println("YES")
			return
		}
	}
	fmt.Println("NO")
}
//  [go]
package main

import (
  "fmt"
)

func absInt(x int) int {if x >= 0 {return x}; return -x}
func gcd(a, b int) int {if (b == 0) {return absInt(a)}; return gcd(b, a % b)}
func lcm(a, b int) int {return absInt(a / gcd(a, b) * b)}

func main() {
  var a, b, c int 
  fmt.Scan(&a, &b, &c)
  g := gcd(a, b)
  ans := "NO"
  if c % g == 0 {ans = "YES"}
  fmt.Println(ans)
}
//  [go]
package main

import (
	"fmt"
)

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

	for i := a; i <= 100000000; i += a {
		if (i-c)%b == 0 {
			fmt.Println("YES")
			return
		}
	}
	fmt.Println("NO")
}
//  [go]
package main

import "fmt"

func main() {
	var A, B, C int
	fmt.Scan(&A, &B, &C)
	var ans string
	ans = "NO"
	for i := 1; i < 1000000; i++ {
		a := A * i
		if a%B == C {
			ans = "YES"
		}
	}
	fmt.Println(ans)
}
//  [ruby]
A,B,C=$<.read.split.map(&:to_i)

1.upto(100) do |i|
    if (B*i+C) % A == 0
        puts 'YES'
        exit 0
    end
end

puts 'NO'
//  [ruby]
a, b, c = gets.chomp.split.map(&:to_i)

remainders = [0]
while true do
  break if remainders[-1] == c

  remainders.push((remainders[-1] + a) % b)
  break if remainders[-1] == remainders[0]
end

ans = remainders[-1] == c ? "YES" : "NO"
puts ans
//  [ruby]
A, B, C = gets.split.map &:to_i
1.upto(B).each do |i|
    n = i * A
    if n % B == C
        puts 'YES'
        exit
    end
end
puts 'NO'
//  [ruby]
A, B, C = gets.chomp.split(' ').map(&:to_i)

ans =  (1..10000000).find {|n| (B * n + C) % A == 0}
puts ans.nil? ? :NO : :YES
//  [ruby]
a,b,c = gets.split.map &:to_i
for i in 0..1000000
  if (a*i-c) % b ==0
    puts "YES"
    exit 0
  end
end
puts "NO"
//  [ruby]
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

A,B,C=get_i
a=A
seen=Hash.new(false)
until a==C or seen[a]
    seen[a]=true
    a+=A
    a%=B
end
if seen[a]
    puts "NO"
else
    puts "YES"
end
//  [rust]
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let a: usize = itr.next().unwrap().parse().unwrap();
    let b: usize = itr.next().unwrap().parse().unwrap();
    let c: usize = itr.next().unwrap().parse().unwrap();
    for i in 1..200 {
        if a * i % b == c {
            println!("YES");
            return;
        }
    }
    println!("NO");
}
//  [rust]
use std::io::BufRead;
fn main() {
    let stdin = std::io::stdin();
    let mut lock = stdin.lock();
    let mut abc = String::new();
    let _ = lock.read_line(&mut abc);
    let abc = abc
        .trim()
        .split_whitespace()
        .map(|n| n.parse::<u32>().unwrap())
        .collect::<Vec<_>>();
    println!(
        "{}",
        if solve(abc[0], abc[1], abc[2]) {
            "YES"
        } else {
            "NO"
        }
    );
}

fn solve(a: u32, b: u32, c: u32) -> bool {
    let mut history: Vec<bool> = Vec::with_capacity(b as usize);
    let mut current = a % b;
    for _ in 0..b as usize {
        history.push(false);
    }
    loop {
        if current == c {
            return true;
        }
        if history[current as usize] {
            return false;
        } else {
            history[current as usize] = true;
            current = (current + a) % b;
        }
    }
}
//  [rust]
use proconio::input;
fn main() {    
    input!{
        a: i32, b: i32, c:i32
    }    
    if (0..b).any(|x| (x*(a%b) - c)%b == 0){
        println!("YES")
    }
    else{
        println!("NO")
    }
}
//  [rust]
use std::io;
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let A: i32 = iter.next().unwrap().parse().unwrap();
    let B: i32 = iter.next().unwrap().parse().unwrap();
    let C: i32 = iter.next().unwrap().parse().unwrap();
    for k in 0..10000000 {
      if (k * A) % B == C {
          println!("{}", "YES");
          return;
      }
    }
    println!("{}", "NO");
}
//  [rust]
#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(dead_code)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;


#[fastout]
fn solve() {
    const MOD: usize = 1_000_000_007;
    const INF: usize = std::usize::MAX;
    
    input!{
        a: usize, b: usize, c: usize,
    }
    let mut sum = a;
    let mut ans = false;

    for _ in 0..10000 {
        if sum % b == c {
            ans = true;
            break
        }
        sum += a;
    }

    if ans {
        println!("YES");
    } else {
        println!("NO");
    }
}

fn main() {
    solve()
}

#[cfg(test)]
mod test {
    use super::solve;
}
//  [rust]
use whiteread::parse_line;

fn main() {
    let (a, b, c): (u32, u32, u32) = parse_line().unwrap();
    let mut tmp = 0;
    let mut ans = "NO";

    for _ in 0..b {
        if tmp % b == c {
            ans = "YES";
            break;
        }
        tmp %= b;
        tmp += a;
    }
    println!("{}", ans);
}
//  [swift]
import Foundation
func toTuple<T>(_ args: [T]) -> (T, T, T) { (args[0], args[1], args[2]) }
func readInts() -> [Int] { readLine()!.split(separator: " ").map { Int($0)! } }

let main = {
  let (a, b, c) = toTuple(readInts())
  for i in 1...b {
    if a * i % b == c { print("YES"); return }
  }
  print("NO")
}
main()
//  [swift]
import Foundation
//最大公約数を求める関数
func gcd(_ num1: Int, _ num2: Int) -> Int {
   let r = num1 % num2
   if r != 0 {
       return gcd(num2, r)
   } else {
       return num2
   }
}
//３つ以上の数の最大公約数を求める
func gcdArr(_ numArr: [Int]) -> Int {
    var ans: Int = numArr[0]
    for i in numArr {
        ans = gcd(ans, i)
    }
    return ans
}

//最小公倍数を求める関数
func lcm(_ num1: Int, _ num2: Int) -> Int {
    
    var gcdNum = gcd(num1, num2)
    return num1*num2/gcdNum
}

//３つ以上の最大公約数を求める
func lcmArr(_ numArr: [Int]) -> Int {
    var ans: Int = 1
    for i in numArr {
        ans = lcm(ans, i)
    }
    return ans
}

//一次不定方程式 ax+by=gcd(a,b)を満たすa,b
func solveIdentifyEquasion(_ a: Int,_ b: Int) -> [Int]{
    var (d,d_): (Int,Int) = (a,b)
    var (x,x_) = (1,0)
    var (y,y_) = (0,1)
    var q: Int
    
    while d_ != 0 {
        q = d/d_
        (d,d_) = (d_,d%d_)
        (x,x_) = (x_,x-q*x_)
        (y,y_) = (y_,y-q*y_)
    }
    return [x,y]
}


func solveIdentifyEquasion2(_ a: Int,_ b: Int, _ c: Int) -> [Int]{
    return (solveIdentifyEquasion(a, b).map({$0 * c/gcd(a, b)}))
}

let rl = readLine()!.split(separator: " ").map({Int($0)!})
if rl[2].isMultiple(of: gcd(rl[0], rl[1])) {
    print("YES")
} else {
    print("NO")
}
//  [swift]
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/



/*************** メインプログラム ***************/

let input = readIntSplit(by: " ")
let (A, B, C) = (input[0], input[1], input[2])
var ans = "NO"
for i in 1...B {
    if A*i % B == C {
        ans = "YES"
        break
    }
}
print(ans)
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))}
const main=()=>{
  let [a,b,c]=tnn(3)
  for(let i=1;i<=b;i++){
    if(a*i%b==c){
      to('YES')
      return
    }
  }
  to('NO')
}
main()
//  [typescript]
function main(input) {
  input = input.trim();
  const [a, b, c] = input.split(" ").map(a => Number(a));
  let result = "NO";
  for (let i = 1; i <= b; i++) {
    if (a*i%b === c) {
      result = "YES";
      break;
    }
  }
  console.log(result);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
function*stdinIter(){const t=require("fs").readFileSync("/dev/stdin","utf-8").trim().split(/\n|\s/);yield*t}function readMany(t,e){const i=e||this.iter||(this.iter=stdinIter()),n=[];for(let e=0;e<t;e+=1)n.push(i.next().value);return n};

(() => {
    const [ a, b, c ] = readMany(3).map(it => parseInt(it))

    // n * B + C が A の倍数になる整数 n があればよい。
    for (let n = 1; n <= 200; n += 1) {
        if ((n * b + c) % a == 0) return console.log('YES')
    }
    console.log('NO')
})()
//  [typescript]
{
  const run = (input: string) => {
    const [a, b, c] = input.trim().split(" ").map(v => parseInt(v))

    const sum = b + c
    let a2 = a
    for (let i = 0; i <= sum; i++) {
      if (a2 % b === c) {
        return 'YES'
      } else {
        a2 += a
      }
    }

    return 'NO'
  }

  const Main = (input: string) => {
    console.log(run(input))
  };

  Main(require("fs").readFileSync("/dev/stdin", "utf8"));
}
//  [typescript]
"use strict"
const Main = (input) =>{
  let xs = input.trim().split(" ").map(v=>parseInt(v,10));
    let A = xs[0];
    let B = xs[1];
    let C = xs[2];
    let ans = "NO";
      for(let i=0; i<=100; i++){
        if((A*i)%B==C){
          ans = "YES"
          break;
        }
      }
    console.log(ans);
  }
Main(require("fs").readFileSync("/dev/stdin","utf8"));
//  [typescript]
function main(input:string) {
  const i = input.split(" ");
  const a = parseInt(i[0], 10);
  const b = parseInt(i[1], 10);
  const c = parseInt(i[2], 10);
  let result = "NO";
 
  for (let i = 1; i <= 100; i++){
    if ((i*a) % b === c) {
      result = "YES";
      break;
    }
  }
  console.log(result);
 
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [python]
import sys
import numpy as np

# input = sys.stdin.readline

n, b, a = map(int,input().split())

sho = n // (a + b) 

mod = n % (a + b)

if mod <= b:
    b_num = sho * b + mod
else:
    b_num = sho * b + b
print(b_num)
//  [python]
import numpy as np

n, a, b = np.asarray(input().split(), dtype=np.uint64)

times = np.asarray([0], dtype=np.uint64)
times += n // (a+b)

last = np.asarray([0], dtype=np.uint64)
last += n % (a+b)

answer = np.asarray([0], dtype=np.uint64)

if last <= a:
    answer += times * a + last
else:
    answer += a * (times + 1)

print(int(answer))
//  [python]
import numpy as np
N, A, B = list(map(int, input().split()))

count = A + B
hoge1 = N // count
hoge2 = N % count

ans1 = A * hoge1

if hoge2 < A:
    print(ans1 + hoge2)
else:
    print(ans1 + A)
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * for (int i = 0; i < N; i++) {}
 * System.out.println();
 * @author mj
 *
 */
public class Main implements Runnable { //クラス名はMain2

	public static void main(String[] args) {
		Thread.setDefaultUncaughtExceptionHandler((t, e) -> System.exit(1));
		new Thread(null, new Main(), "", 16 * 1024 * 1024).start(); //16MBスタックを確保して実行
	}

	public void run() {
		FastScannerMain2 sc = new FastScannerMain2(System.in);

		try {
			long N = sc.nextLong();
			long A = sc.nextLong();
			long B = sc.nextLong();
			long ans = 0;

			if (A == 0 || (A == 0 && B == 0)) {
				ans = 0;
			} else {
				long sumA = 0;
				long num = N / (A + B);
				long num2 = N % (A + B);

				sumA += num * A;

				if (num2 > A) {
					sumA += A;
				} else {
					sumA += num2;
				}

				ans = sumA;

				if (A == 0) {
					ans = 0;
				}
			}

			System.out.println(ans);
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
}

//高速なScanner
class FastScannerMain2 {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScannerMain2(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

	public String next() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}
//  [c]
/* ????????? */

#include <stdio.h>

int main(void) {
  unsigned long  N, A, B, AandB;
  unsigned long  count = 0;
  unsigned long  i = 0;
  scanf("%lu%lu%lu",&N, &A, &B);
  
  AandB = A+B;
  /* ????????????????????????????? */
  if(N/10000000000000 >= AandB){
    while(N/(i+=10000000000000) >= (AandB));
  	i -= 10000000000000;
  }
  /* !!!!!!!!????????!!!!?!?!?!?!?!? */
  if(N/10000000 >= AandB){
    while(N/(i+=10000000) >= (AandB));
  	i -= 10000000;
  }
  while(N/(++i) >= (AandB));
  
  N -= (AandB)*--i;
  count = A*i;
  
  if(N < A)
    count += N;
  else
    count += A;
  printf("%lu\n",count);
  
  return 0;
}
//  [c]
#include <stdio.h>

int main() {
    long long n, Bnum, Rnum,ans;
    scanf("%ld %ld %ld", &n, &Bnum, &Rnum);
    ans = (n / (Bnum + Rnum)) * Bnum;
    if (n % (Bnum + Rnum) < Bnum) {
        ans += n % (Bnum + Rnum);
    }
    else {
        ans += Bnum;
    }
    printf("%ld\n", ans);
    return 0;
}
//  [c]
#include <stdio.h>

int main(){
  long n,a,b,m,c;
  scanf("%ld",&n);
  scanf("%ld",&a);
  scanf("%ld",&b);
  c=a+b;
  m=(n/c)*a;
  if(n%c<=a){
    printf("%ld",m+(n%c));
  }else{
    printf("%ld",m+a);
  }
  return(0);
}
//  [javascript]
const input = require("fs").readFileSync("/dev/stdin", "utf8")
const lines = input.split('\n')
const [N, A, B] = lines[0].split(' ').map(BigInt)
const ans = N / (A + B) * A + (N % (A + B) < A ? (N % (A + B)) : A)
console.log(ans.toString())
//  [go]
package main

import (
	"fmt"
)

func main() {

	var N, A, B int
	fmt.Scanf("%d %d %d", &N, &A, &B)

	var result int

	result = A * (N / (A + B))

	if (N % (A + B)) >= A {
		result += A
	} else {
		result += (N % (A + B))
	}

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

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

func main() {
	n, a, b := readI(), readI(), readI()
	g := n / (a + b)
	r := n % (a + b)
	if r > a {
		r = a
	}
	fmt.Println(g*a + r)
}

/*-----------Input utils-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if len(os.Args) >= 2 {
		if os.Args[1] == "debug" {
			debug()
		}
	}
	const buf = 200100
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, buf), buf)
}

func debug() {
	testFile, err := os.Open("./test/sample-1.in")
	if err != nil {
		fmt.Fprintln(os.Stderr, "There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

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

func readR() []rune {
	return []rune(readS())
}

func readI() int {
	i, _ := strconv.Atoi(readS())
	return i
}

func readF() float64 {
	f, _ := strconv.ParseFloat(readS(), 64)
	return f
}
//  [go]
package main

import "fmt"

func main() {
	var N, A, B int
	fmt.Scan(&N, &A, &B)
	fmt.Println(N/(A+B)*A + Min(A, N%(A+B)))
}

func Min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
//  [ruby]
require 'set'; require 'prime'
INF=Float::INFINITY; MOD=10**9+7
n,a,b = gets.chomp.split.map(&:to_i)

ans = n / (a+b) * a
amari = n % (a+b)
amari = a if amari > a
ans += amari

puts ans
//  [ruby]
require 'prime'
MOD=10**9+7;  cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.chomp.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def ar2(s1,s2,de=nil) Array.new(s1){Array.new(s2,de)} end
def ar3(s1,s2,s3,de=nil) Array.new(s1){Array.new(s2){Array.new(s3,de)}} end

def desc(ar) ar.sort!{|x,y| y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end
def ceil(a,b) (a.to_f/b).ceil end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end
def rui(ar) s=[0]; ar.size.times{|i| s<<s[-1]+ar[i]}; s end
def rev_rui(ar) s=[0]; ar.size.times.reverse_each{|i| s<<s[-1]+ar[i]}; s end

def puts_yesno(b) puts(b ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def pu(h) begin; require './../nemi_lib/debug.rb'; puts_val(h); rescue LoadError; end; end
########### ( ˘ω˘ )ｽﾔｧ… ###########
n,a,b=gsmi

div=n/(a+b)
mod=n%(a+b)

puts div*a+min(mod,a)
//  [ruby]
require 'pp'

n, a, b = gets.split.map(&:to_i)

t = n / (a + b)
rem = n % (a+b)
puts t * a + [rem, a].min
//  [swift]
import Foundation

let input = readLine()!.components(separatedBy: " ").map{ Int($0)!}
let N = input[0]
let blue = input[1]
let red = input[2]

let pareNum = N / (red + blue)
let remain = N % (red + blue)
var blueBall = 0

if remain > blue {
    blueBall += blue
}else {
    blueBall += remain
}
blueBall += pareNum * blue

print(blueBall)
//  [swift]
import Foundation

/*
// 1
let N = Int(readLine()!)!

// 1 2
let split = readLine()!.componentsSeparatedByString(" ")
let N = Int(split[0])!
let S = Int(split[1])!

// 1 2 3 4 5
let array = readLine()!.componentsSeparatedByString(" ").map { Int($0)! }

func pow(_ number: Int, multiplier: Int) -> Int {
  var answer = 1
  for _ in 0 ..< multiplier {
    answer *= number 
  }
  return answer
}


*/
let split = readLine()!.componentsSeparatedByString(" ")
let N = Int(split[0])!
let A = Int(split[1])!
let B = Int(split[2])!
var answer = 0
answer = (N / (A + B)) * A
let surplus = N % (A + B)
if surplus < A {
	answer += surplus
} else {
 	answer += A 
}
print(answer)
//  [python]
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

import numpy as np

def get_time(i):
    return int(np.ceil(i / 10) * 10)

total1 = get_time(a) + get_time(b) + get_time(c) + get_time(d) + e
total2 = a + get_time(b) + get_time(c) + get_time(d) + get_time(e)
total3 = get_time(a) + b + get_time(c) + get_time(d) + get_time(e)
total4 = get_time(a) + get_time(b) + c + get_time(d) + get_time(e)
total5 = get_time(a) + get_time(b) + get_time(c) + d + get_time(e)
print(min([total1, total2, total3, total4, total5]))
//  [python]
# encoding:utf-8
import copy
import numpy as np
import random
import bisect #
import math

ans = 0
menu_time = []
for i in range(5):
    menu_time.append(int(input()))

amari = 10
for i in range(5):
    if menu_time[i]%10>0:
        amari = min(menu_time[i]%10,amari)
    ans += math.ceil(menu_time[i]/10)*10

ans -= 10
ans += amari


print(ans)
//  [python]
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

A = [I() for i in range(5)]
num = 0
tmp = 0
for i in range(5):
    if str(A[i])[-1] != "0":
        num = max(num,10 - int(str(A[i])[-1]) )
        tmp += 10
    if len(str(A[i]))!=1:
        tmp += 10*int(str(A[i])[:-1])

print(tmp-num)
//  [java]
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[]$) {
        List<Integer> list = IntStream.range(0, 5).map(i -> scanner.nextInt())
                .boxed()
                .sorted(Comparator.comparingInt(i -> (i - 1) % 10))
                .collect(Collectors.toList());
        System.out.println(list.get(0) + list.subList(1, list.size()).stream().mapToInt(i -> (i - 1) / 10 * 10 + 10).sum());
    }
}
//  [java]
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Main {
    private static final int INTERVAL = 10;

    private static class Dish {
        final int time;
        final int roundUp;
        final int timeWasted;

        private Dish(int time, int roundUp, int timeWasted) {
            this.time = time;
            this.roundUp = roundUp;
            this.timeWasted = timeWasted;
        }

        static Dish fromInt(int i) {
            int roundUp = ((i + INTERVAL - 1) / INTERVAL) * INTERVAL;
            int timeWasted = roundUp - i;
            return new Dish(i, roundUp, timeWasted);
        }

        int getTimeWasted() {
            return this.timeWasted;
        }

        int getRoundUp() {
            return this.roundUp;
        }
    }

    public static String process(int a, int b, int c, int d, int e) {
        List<Dish> dishes = Stream.of(a, b, c, d, e)
                .map(Dish::fromInt)
                .sorted(Comparator.comparing(Dish::getTimeWasted))
                .collect(Collectors.toList());

        int lastDish = dishes.size() - 1;
        int lastDishTime = dishes.get(lastDish).time;
        int totalTime = lastDishTime + IntStream.range(0, lastDish).mapToObj(dishes::get).mapToInt(Dish::getRoundUp).sum();

        return String.valueOf(totalTime);
    }
    // Util func

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();

        final String result = process(a, b, c, d, e);

        output(result);
    }

    private static void output(String result) {
        System.out.println(result);
    }
}
//  [java]
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
    private static final int INTERVAL = 10;

    private static class Dish{
        final int time;
        final int roundUp;
        final int timeWasted;

        private Dish(int time, int roundUp, int timeWasted){
            this.time = time;
            this.roundUp = roundUp;
            this.timeWasted = timeWasted;
        }

        static Dish fromInt(int i){
            int roundUp = ((i+INTERVAL -1)/INTERVAL)*INTERVAL;
            int timeWasted = roundUp-i;
            return new Dish(i, roundUp, timeWasted);
        }

        int getRoundUp(){
            return this.roundUp;
        }
    }

    public static String process(int a, int b, int c, int d, int e) {
        List<Integer> times = Arrays.asList(a,b,c,d,e);
        List<Dish> dishes = times.stream().map(Dish::fromInt).collect(Collectors.toList());
        dishes.sort((d1, d2)->Integer.compare(d1.timeWasted, d2.timeWasted));

        int sum = 0;
        int lastDish = dishes.size()-1;
        int lastDishTime = dishes.get(lastDish).time;
        int totalTime = lastDishTime + IntStream.range(0, lastDish ).mapToObj(dishes::get).mapToInt(Dish::getRoundUp).sum();

        return String.valueOf(totalTime);
    }
    // Util func

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();

        final String result = process(a, b, c, d, e);

        output(result);
    }

    private static void output(String result) {
        System.out.println(result);
    }
}
//  [cpp]
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;

int main(){
    int min=10,sum=0;
    vector<int>c(100000000);
    vector<int>d(100000000);
    for(int i=0;i<5;i++){
        cin>>c[i];
        sum+=((c[i]+9)/10)*10;
        if(min>c[i]%10&&c[i]%10!=0){
            min=c[i]%10;
        }

    }
    
    cout<<sum-10+min;
}
//  [cpp]
#include <iostream>
using namespace std;

int main() {
    int min = 10;
    int t = 0;
    int nextOrderTime = 0;

    for (int i = 0; i < 5; i++) {
      cin >> t;
      if (min > t % 10 && t % 10) {
        min = t % 10;
      }
      if (t % 10 == 0) {
        nextOrderTime += t;
      } else {
        nextOrderTime += ((t / 10) + 1) * 10;
      }
    }
    cout << nextOrderTime - 10 + min << endl;

    return 0;
}