import java.io.*;
import java.util.*;

public class Main {
    static PrintWriter out = new PrintWriter(System.out);
    static Scanner sc = new Scanner(System.in);
    static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int k;
    long[] d;
    public static void main(String[] args) throws IOException {
        Main main = new Main();
//        main.solve();
        System.out.println(main.solve());
    }
    int solve() throws IOException{
        int a = sc.nextInt(), b = sc.nextInt();
        for(int i=1;i<1000000;i++){
            if(valid(i,a,b)) return i;
        }
        return -1;
    }
    boolean valid(int x, int a, int b){
        int y1 = 8*x/100, y2 = x/10;
        return y1==a&&y2==b;
    }
}
 import java.io.*; io.* java import java.util.*; util.* java public class Main {
    static PrintWriter out = new PrintWriter(System.out);
    static Scanner sc = new Scanner(System.in);
    static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int k;
    long[] d;
    public static void main(String[] args) throws IOException {
        Main main = new Main();
//        main.solve();
        System.out.println(main.solve());
    }
    int solve() throws IOException{
        int a = sc.nextInt(), b = sc.nextInt();
        for(int i=1;i<1000000;i++){
            if(valid(i,a,b)) return i;
        }
        return -1;
    }
    boolean valid(int x, int a, int b){
        int y1 = 8*x/100, y2 = x/10;
        return y1==a&&y2==b;
    }
} Main static PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) int k; k long[] d; d public static void main(String[] args) throws IOException {
        Main main = new Main();
//        main.solve();
        System.out.println(main.solve());
    } main {
        Main main = new Main();
//        main.solve();
        System.out.println(main.solve());
    } Main main = new Main(); main new Main() System.out.println(main.solve()) System.out.println System.out System System.out main.solve() main.solve main String[] args args int solve() throws IOException{
        int a = sc.nextInt(), b = sc.nextInt();
        for(int i=1;i<1000000;i++){
            if(valid(i,a,b)) return i;
        }
        return -1;
    } solve {
        int a = sc.nextInt(), b = sc.nextInt();
        for(int i=1;i<1000000;i++){
            if(valid(i,a,b)) return i;
        }
        return -1;
    } int a = sc.nextInt() a sc.nextInt() sc.nextInt sc b = sc.nextInt(); b sc.nextInt() sc.nextInt sc for(int i=1;i<1000000;i++){
            if(valid(i,a,b)) return i;
        } int i=1; int i=1; i 1 i<1000000 i 1000000 i++ i++ i {
            if(valid(i,a,b)) return i;
        } {
            if(valid(i,a,b)) return i;
        } if(valid(i,a,b)) return i; valid(i,a,b) valid i a b return i; i return -1; -1 1 boolean valid(int x, int a, int b){
        int y1 = 8*x/100, y2 = x/10;
        return y1==a&&y2==b;
    } valid {
        int y1 = 8*x/100, y2 = x/10;
        return y1==a&&y2==b;
    } int y1 = 8*x/100 y1 8*x/100 8*x 8 x 100 y2 = x/10; y2 x/10 x 10 return y1==a&&y2==b; y1==a&&y2==b y1==a y1 a y2==b y2 b int x x int a a int b b public class Main {
    static PrintWriter out = new PrintWriter(System.out);
    static Scanner sc = new Scanner(System.in);
    static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int k;
    long[] d;
    public static void main(String[] args) throws IOException {
        Main main = new Main();
//        main.solve();
        System.out.println(main.solve());
    }
    int solve() throws IOException{
        int a = sc.nextInt(), b = sc.nextInt();
        for(int i=1;i<1000000;i++){
            if(valid(i,a,b)) return i;
        }
        return -1;
    }
    boolean valid(int x, int a, int b){
        int y1 = 8*x/100, y2 = x/10;
        return y1==a&&y2==b;
    }
} public class Main {
    static PrintWriter out = new PrintWriter(System.out);
    static Scanner sc = new Scanner(System.in);
    static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int k;
    long[] d;
    public static void main(String[] args) throws IOException {
        Main main = new Main();
//        main.solve();
        System.out.println(main.solve());
    }
    int solve() throws IOException{
        int a = sc.nextInt(), b = sc.nextInt();
        for(int i=1;i<1000000;i++){
            if(valid(i,a,b)) return i;
        }
        return -1;
    }
    boolean valid(int x, int a, int b){
        int y1 = 8*x/100, y2 = x/10;
        return y1==a&&y2==b;
    }
} Main
import java.io.*;
import java.util.*;

public class Main {
    static PrintWriter out = new PrintWriter(System.out);
    static Scanner sc = new Scanner(System.in);
    static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int k;
    long[] d;
    public static void main(String[] args) throws IOException {
        Main main = new Main();
//        main.solve();
        System.out.println(main.solve());
    }
    int solve() throws IOException{
        int a = sc.nextInt(), b = sc.nextInt();
        for(int i=1;i<1000000;i++){
            if(valid(i,a,b)) return i;
        }
        return -1;
    }
    boolean valid(int x, int a, int b){
        int y1 = 8*x/100, y2 = x/10;
        return y1==a&&y2==b;
    }
}

