module AtCoder

open System
open System.Collections
open System.IO
open System.Linq
open System.Text

module NumericLiteralG =
    let inline FromZero(): ^a = LanguagePrimitives.GenericZero
    let inline FromOne(): ^a = LanguagePrimitives.GenericOne
    let inline FromInt32 n = Seq.sumBy (fun _ -> FromOne()) { 1 .. n }

[<AutoOpen>]
module Ex =
    type long = int64

    type double = float

    let inline long x = int64 x
    let inline double x = float x
    let inline (+=) (x: ^a byref) (y: ^a) = x <- x + y
    let inline (-=) (x: ^a byref) (y: ^a) = x <- x - y

    let inline postIncr (x: ^a byref): ^a =
        x <- x + 1G
        x - 1G

    let inline preIncr (x: ^a byref): ^a =
        x <- x + 1G
        x

    let inline postDecr (x: ^a byref): ^a =
        x <- x - 1G
        x + 1G

    let inline preDecr (x: ^a byref): ^a =
        x <- x - 1G
        x

[<AutoOpen>]
module Input =
    type ConvertTrait< ^a> =
        { FromStr: string -> ^a }

    module Internal =

        type ConvertBuiltin = ConvertBuiltin
            with
                static member inline ConvertImpl(_: System.Int32): ConvertTrait<System.Int32> = { FromStr = int }
                static member inline ConvertImpl(_: System.Int64): ConvertTrait<System.Int64> = { FromStr = long }

                static member inline ConvertImpl(_: System.Double): ConvertTrait<System.Double> = { FromStr = double }

                static member inline ConvertImpl(_: System.Char): ConvertTrait<System.Char> = { FromStr = char }

                static member inline ConvertImpl(_: System.String): ConvertTrait<System.String> = { FromStr = id }

        let inline getImpl (builtin: ^builtin) (_: ConvertTrait< ^a >) =
            ((^builtin or ^a): (static member ConvertImpl: 'a -> ConvertTrait< ^a >) (Unchecked.defaultof< ^a>))

        let inline fromStr (x: string): ^a =
            (getImpl ConvertBuiltin (Unchecked.defaultof<ConvertTrait< ^a >>)).FromStr(x)

        type Input() =



            [<Literal>]
            let size = 5000

            let stream = Console.OpenStandardInput()
            let buffer = Array.zeroCreate size
            let mutable (ptr, bufferSize) = (0, 0)

            let hasNextByte(): bool =
                if ptr < bufferSize then
                    true
                else
                    ptr <- 0
                    bufferSize <- stream.Read(buffer, 0, size)
                    bufferSize > 0



            let readByte(): byte =
                if hasNextByte() then buffer.[postIncr &ptr]
                else failwith "buffer empty"

            let isAscii (c: int): bool = int '!' <= c && c <= int '~'

            let nextChar(): char =
                let mutable b = readByte()
                while (not << isAscii << int) b do
                    b <- readByte()
                char b



            let next(): string =
                // TODO
                let sb = StringBuilder()
                let mutable c = readByte()
                while (isAscii << int) c do
                    sb.Append(char c) |> ignore
                    c <- readByte()
                sb.ToString()

            member __.String = next()

        let input = Input()

    let inline get(): ^a = Internal.fromStr (Internal.input.String)
    let inline getString(): string = get()
    let inline getInt(): int = get()

let A = get()
let B = get()

let f (x: int) (rate:double):int =
    double x * rate
    |> int

let list = [0..2000]
let aSet = list |> List.where(fun x -> f x 0.08 = A) |> Set.ofList
let bSet = list |> List.where(fun x -> f x 0.10 = B) |> Set.ofList

let cSet = Set.intersect aSet bSet

if Set.isEmpty cSet then
    -1
else
    Set.minElement cSet
|> printfn "%i"


Measured memory_bytes: 15068