package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) func Scanner() string { sc.Scan() return sc.Text() } func main() { buf := make([]byte, 0) sc.Buffer(buf, 100000007) sc.Split(bufio.ScanWords) a, _ := strconv.Atoi(Scanner()) b, _ := strconv.Atoi(Scanner()) ans := -1 if gcd(a, b) > 1 { fmt.Println(ans) return } else { ans = (a - 1) * (b - 1) / 2 } fmt.Println(ans) } func gcd(a int, b int) int { if b == 0 { return a } return gcd(b, a%b) }