Problem:
Score : 300 points

Problem Statement

Find the price of a product before tax such that, when the consumption tax rate is 8 percent and 10 percent, the amount of consumption tax levied on it is A yen and B yen, respectively. (Yen is the currency of Japan.)

Here, the price before tax must be a positive integer, and the amount of consumption tax is rounded down to the nearest integer.

If multiple prices satisfy the condition, print the lowest such price; if no price satisfies the condition, print -1.

Constraints

1 \leq A \leq B \leq 100

A and B are integers.

Input

Input is given from Standard Input in the following format:

A B

Output

If there is a price that satisfies the condition, print an integer representing the lowest such price; otherwise, print -1.

Sample Input 1

2 2

Sample Output 1

25

If the price of a product before tax is 25 yen, the amount of consumption tax levied on it is:

When the consumption tax rate is 8 percent: \lfloor 25 \times 0.08 \rfloor = \lfloor 2 \rfloor = 2 yen.

When the consumption tax rate is 10 percent: \lfloor 25 \times 0.1 \rfloor = \lfloor 2.5 \rfloor = 2 yen.

Thus, the price of 25 yen satisfies the condition. There are other possible prices, such as 26 yen, but print the minimum such price, 25.

Sample Input 2

8 10

Sample Output 2

100

If the price of a product before tax is 100 yen, the amount of consumption tax levied on it is:

When the consumption tax rate is 8 percent: \lfloor 100 \times 0.08 \rfloor = 8 yen.

When the consumption tax rate is 10 percent: \lfloor 100 \times 0.1 \rfloor = 10 yen.

Sample Input 3

19 99

Sample Output 3

-1

There is no price before tax satisfying this condition, so print -1.

Solution in C++14 (GCC 5.4.1) (judge verdict: Accepted)

#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
using namespace std;

int syc(long i,long Min,long Max){
	if(Min <= i && i <= Max){
		return 1;
	}else{
		exit(1);
		//return 0;
	}
}

int gnk_a(int x){
	
	int xx=(x*25)/2;
	if((x*25)%2 != 0){
		xx++;
	}
	return xx;
}
int gnk_b(int x){
	return x*10;
}
int shz_a(int x){
	return (x*8)/100;
}
int shz_b(int x){
	return x/10;
}

int main(){
	int a,b;
	cin >> a >> b;
	syc(a,1,100);
	syc(b,1,100);
	int aa[100];
	int bb[100];
	int aaa[100];
	int num_a=0,num_b=0;

	/*
	cout << "shz_a(gnk_a(a))=   " << shz_a(gnk_a(a)+10) << endl;
	cout << "shz_b(gnk_b(b))=   " << shz_b(gnk_b(b)+10) << endl;
	*/
	
	//aa[0]=-99;
	for(int i=0;i<100;i++){ 
		if(shz_a(gnk_a(a)+i)>=a+1)break;
		aa[i]=gnk_a(a)+i;
		//cout << aa[i] << endl;
		num_a++;
	}
	//cout << endl;
	//bb[0]=-99;
	for(int i=0;i<10000;i++){ 
		if(shz_b(gnk_b(b)+i)>=b+1)break;
		bb[i]=gnk_b(b)+i;
		//cout << bb[i] << endl;
		num_b++;
	}
	/*
	for(int i=0;i<num_a;i++){ 
		cout << aa[i] << endl;
	}
	cout << endl;
	for(int i=0;i<num_b;i++){ 
		cout << bb[i] << endl;
	}
	cout << num_a << endl;
	cout << num_b << endl;
	cout << "XXXX" << endl;
	*/
	if(num_a <= num_b){
		for(int i=0;i<num_a;i++){
			for(int j=0;j<num_b;j++){
				if(aa[i] == bb[j]){
					cout << aa[i] << endl;
					return 0;
				}
			}
		}
	}else if(num_a > num_b){
		for(int i=0;i<num_b;i++){
			for(int j=0;j<num_a;j++){
				if(bb[i] == aa[j]){
					cout << bb[i] << endl;
					return 0;
				}
			}
		}
	}
	
	cout << "-1" << endl;
	return 0;
}