/*
URL:
https://codeforces.com/problemset/problem/817/A
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	x1, y1, x2, y2 int
	x, y           int
)

func main() {
	x1, y1, x2, y2 = ReadInt4()
	x, y = ReadInt2()

	dx := AbsInt(x1 - x2)
	dy := AbsInt(y1 - y2)

	if dx == 0 && dy == 0 {
		fmt.Println("YES")
		return
	}

	if dx%x != 0 || dy%y != 0 {
		fmt.Println("NO")
		return
	}

	qx := dx / x
	qy := dy / y
	qx %= 2
	qy %= 2

	if qx != qy {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
	}
}

// AbsInt is integer version of math.Abs
func AbsInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}


package main

import "fmt"

func gcd(a int, b int, x *int, y *int) int {
    if a == 0 {
        *x, *y = 0, 1
        return b
    }
    var xx, yy int
    g := gcd(b%a, a, &xx, &yy)
    *x = yy - (b/a)*xx
    *y = xx
    return g
}

func normal(n int, mod *int) int {
    n %= (*mod)
    if n < 0 {
        n += (*mod)
    }
    return n
}

func inv(a int, mod *int) int {
    var x, y int
    gcd(a, *mod, &x, &y)
    return normal(x, mod)
}

func addmod(a, b int, mod *int) int {
    if a + b >= (*mod) {
        return a + b - (*mod)
    } else {
        return a + b
    }
}

func submod(a, b int, mod *int) int {
    if a - b < 0 {
        return a - b + (*mod)
    } else {
        return a - b
    }
}

func mulmod(a, b int, mod *int) int {
    return int((int64(a)*int64(b))%int64(*mod))
}

func divmod(a, b int, mod *int) int {
    return mulmod(a, inv(b, mod), mod)
}

func binpowmod(a, b int, mod *int) int {
    ans := 1
    for b > 0 {
        if b%2 == 1 {
            ans = mulmod(ans, a, mod)
        }
        a = mulmod(a, a, mod)
        b = b/2
    }
    return ans
}

func calc(y []int, x int, mod *int) int {
/*
    L(x) = SUM(     y_i * PROD((x-x_j)/(x_i-x_j))    )  j = 1,n; j != i;    i = 1,n
    x_i = i-1
    y_i = L(x_i)
*/
    ans := 0
    k := 1
    for j := 1; j < len(y); j++ {
        k = mulmod(k, normal(x - j, mod), mod)
        k = divmod(k, normal(0 - j, mod), mod)
    }
    for i := 0; i < len(y); i++ {
        ans = addmod(ans, mulmod(y[i], k, mod), mod)
        if (i + 1) >= len(y) {
            break
        }
        k = mulmod(k, divmod(normal(x - i, mod), normal(x - (i + 1), mod), mod), mod)
        k = mulmod(k, divmod(normal(i - (len(y) - 1), mod), normal(i + 1, mod), mod), mod)
    }
    return ans
}

func main() {
    var n, k int
    var mod int = 1000000007
    var y []int = make([]int, 0)
    s := 0
    y = append(y, s)
    fmt.Scanf("%d %d", &n, &k)
    for i := 0; i < k + 1; i++ {
        s = addmod(s, binpowmod(i + 1, k, &mod), &mod) //k-th powwer of (i+1)
        y = append(y, s)
    }
    if n < len(y) {
        fmt.Printf("%d", y[n])
    } else {
        L := calc(y, n, &mod)
        fmt.Printf("%d", L)
    }
}


package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

var n, m, mod int64
var matrix [][]int

func multiply(one, two [][]int) [][]int {
	res := make([][]int, m)
	for i := 0; i < int(m); i++ {
		res[i] = make([]int, m)
	}
	for i := 0; i < int(m); i++ {
		for j := 0; j < int(m); j++ {
			for k := 0; k < int(m); k++ {
				res[i][j] += int(int64(one[i][k]) * int64(two[k][j]) % mod)
				res[i][j] %= int(mod)
			}
		}
	}
	return res
}

func power(exp int64, base [][]int) [][]int {

	if exp == 1 {
		return base
	}

	res := power(exp/2, base)
	res = multiply(res, res)
	if exp&1 == 1 {
		res = multiply(res, base)
	}
	return res
}

func main() {
	defer writer.Flush()
	mod = 1000000007
	scanf("%d %d\n", &n, &m)
	if n < m {
		printf("1")
		return
	}
	if n == m {
		printf("2")
		return
	}
	matrix = make([][]int, m)
	for i := 0; i < int(m); i++ {
		matrix[i] = make([]int, m)
	}
	matrix[0][0] = 1
	matrix[0][m-1] = 1
	for i := 1; i < int(m); i++ {
		matrix[i][i-1] = 1
	}

	fmt.Println(power(n, matrix)[0][0])

}


// 79A
package main

import (
	"fmt"
)

func main() {
	var x, y int64
	w := true
	fmt.Scan(&x, &y)
	for x*10+y >= 22 && y >= 2 {
		if w || (y < 12) {
			x -= 2
			y -= 2
		} else if y < 22 {
			x--
			y -= 12
		} else {
			y -= 22
		}
		w = !w
	}
	if w == true {
		fmt.Print("Hanako")
	} else {
		fmt.Print("Ciel")
	}
}


package main

import (
    "fmt"
    "math"
)

func main() {
    var n,r,R float64
    fmt.Scan(&n,&R,&r)
    if ((n == 1) && (r <= R)) || ((math.Asin(r/(R-r))-(math.Pi/n)) <= 0.0000000001) {
        fmt.Println("YES")
    } else {
        fmt.Println("NO")
    }
}


package main

import (
	"fmt"
)

func main() {
	// Read input.
	var N int
	fmt.Scan(&N)
	a := make([]int, N)
	for i := 0; i < N; i++ {
		var tmp int
		fmt.Scan(&tmp)
		a[i] = tmp
	}
	// Start solving.
	if N == 1 && a[0] == 0 {
		fmt.Println("UP")
		return
	}
	if N == 1 && a[0] == 15 {
		fmt.Println("DOWN")
		return
	}
	if N == 1 && a[0] != 0 && a[0] != 15 {
		fmt.Println(-1)
		return
	}
	// From here I assume a has more than two elements.
	if a[N-2] > a[N-1] && a[N-1] != 0 {
		fmt.Println("DOWN")
		return
	}
	if a[N-2] < a[N-1] && a[N-1] != 15 {
		fmt.Println("UP")
		return
	}
	if a[N-1] == 0 {
		fmt.Println("UP")
		return
	}
	if a[N-1] == 15 {
		fmt.Println("DOWN")
		return
	}
}


package main

import (
	"fmt"
	"log"
	"sort"
)

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func find_last_le_idx(a []int, target int )int {
	//if not exist rturn -1

	s := 0
	e := len(a)
	for ;s < e;{
		mid := s +(e- s)/2
		if a[mid ] <= target{
			s = mid + 1
		}else {
			e = mid
		}
	}
	return s - 1
}

func find_first_ge_idx(a []int, target int )int {
	//if not exist rturn -1

	s := 0
	e := len(a)
	for ;s < e;{
		mid := s +(e- s)/2
		if a[mid ] < target{
			s = mid + 1
		}else {
			e = mid
		}
	}

	return s
}

func maxSumSubmatrix(a [][]int, target int) int {
	row := len(a)
	if row == 0{
		return 0
	}
	col := len(a[0])

	pre_sum := make([][]int, row)
	for i := range pre_sum{
		pre_sum[i] = make([]int ,col)
	}

	for i := 0;i < row; i ++{
		for j :=0;j < col; j ++{
			if j == 0 {
				pre_sum[i][j] = a[i][j]
			}else {
				pre_sum[i][j] = pre_sum[i][j-1] + a[i][j]
			}
		}
	}

	near := -100000000
	for i := 0; i < col ; i ++{
		for j :=i ;j <col; j ++{
			tmp := []int {0}
			cur := 0
			for k := 0;k < row; k++{

				if i == j {
					cur += a[k][i]
				}else if i == 0{
					cur += pre_sum[k][j]
				}else {
					cur += pre_sum[k][j] - pre_sum[k][i-1]
				}
				idx := find_first_ge_idx(tmp, cur  - target)
				if idx != len(tmp){
					near = max(near, cur -tmp[idx] )
				}
				iid := find_first_ge_idx(tmp, cur )
				q := tmp[iid:]
				tmp = append(tmp[:iid], cur)
				tmp = append(tmp ,q...)

				//if k == 0{
				//	if cur ==target || (cur < target&& cur > near) {
				//		near = cur
				//	}
				//	tmp = append(tmp, cur)
				//}
			}

		}
	}
	return near
}

func q(matrix [][]int, k int) int {
	row := len(matrix)
	col := len(matrix[0])
	near := -1000000
	for left := 0; left < col ; left ++{
	// 以left为左边界，每行的总和
		_sum :=make([]int, row)
	//for right in range(left, col):
		for right :=left ;right <col; right ++ {

			for j := 0; j < row; j++ {
				_sum[j] += matrix[j][right]
			}
			// 在left，right为边界下的矩阵，求不超过K的最大数值和
			tmp := []int{0}
			cur := 0
			for _, tmpp := range _sum {
				cur += tmpp

				//# 二分法
				idx := find_first_ge_idx(tmp, cur-k)
				if idx != len(tmp) {
					near = max(near, cur-tmp[idx])
				}
				iid := find_first_ge_idx(tmp, cur)
				q := []int{}

				q= append(q, tmp[iid:]...)
				ee := []int{}
				ee = append(ee,tmp[:iid]...)
				ee = append(ee, cur)
				tmp = append(ee, q...)
			}
		}
		}

	return near
}

func qeqw(a int, aa int) int{

	caa := "asas"
	log.Println(caa)
	return 23
}

func m(a []int, b[]int){
	 //q := map[[2]int]bool{}

}
var ori [1000001]int
var record [1000001]int

var energy [1000001]int
var counter [1000001]int

//}
func p(){
	var n int
	var k int
	var target int
	//var n,k int
	fmt.Scan(&n)
	fmt.Scan(&k)
	for i := 0;i < n; i ++{
		fmt.Scan(&record[i])
	}
	idx := -1
	left := 0
	min_l := 1000000000
	m_l := 0
	m_r := 0
	for ;left < n &&idx < n;{
		if target == k {
			//if counter[record[left]] > 1 {
			if idx - left +1 < min_l{
				min_l = idx - left + 1
				m_l = left
				m_r = idx
			}
			counter[record[left]] --

			//}else {
			//
			//}
			if counter[record[left]] == 0 {
				target --
			}
			left ++
		}else{
				idx ++
			counter[record[idx]] ++
			if counter[record[idx]] == 1{
				target ++
			}
			//idx++
		}
	}
	fmt.Println(m_l + 1, m_r + 1)
}

func ini(){
	var n int
	//var k int
	fmt.Scan(&n)
	//fmt.Scan(&k)
	for i := 0;i < n; i ++{
		fmt.Scan(&ori[i])
		fmt.Scan(&energy[i])
	}
	R := -1
	L := 0
	for i :=0; i < n; i ++{
		//if record[L] == i - k{
		//	L ++
		//}
		for ;R >= L &&ori[i] >ori[record[R]];R--{
			counter[i]	+= energy[record[R]]
		}
		tmp := energy[i]
		for ;R >= L &&ori[i] ==ori[record[R]];R--{
			tmp += energy[i]
		}
		R ++
		record[R] = i
		if R != 0  {
			counter[record[R - 1]] += tmp
		}
	}
	m := -1
	for i :=0; i <n;i ++{
		if counter[i] > m{
			m = counter[i]
		}
	}
	fmt.Println(m)
}
type S struct {
	Idx int
	Time int

}
type intSlice []S

func (p intSlice) Len() int           { return len(p) }
func (p intSlice) Less(i, j int) bool { return p[i].Time > p[j].Time }
func (p intSlice) Swap(i, j int)      { p[i], p[j] = p[j], p[i] }

var roww [1000]int
var coll [1000]int
func inii(){
	var m,n,k,l,d int
	//var k int
	row := make(intSlice, 10000)
	col := make(intSlice, 10000)
	fmt.Scan(&m, &n, &k, &l,&d)
	//fmt.Scan(&k)
	for i := 0;i < d; i ++{
		var x1,y1,x2,y2 int
		fmt.Scan(&x1,&y1,&x2,&y2)
		if x1 == x2 {
			if y1 > y2 {
				y1,y2 = y2,y1
			}
			col[y1].Idx = y1
			col[y1].Time ++
		}else{
				if x1 > x2{
					x1,x2 = x2,x1
				}
				row[x1].Idx = x1
			row[x1].Time ++
		}
		//fmt.Scan(&energy[i])
	}
	//row = row[:m+1]
	//col = col[:n + 1]
	sort.Sort(row)
	sort.Sort(col)
	row = row[:k+1]
	col = col[:l + 1]
	sort.Sort(row)
	sort.Sort(col)
	for i := 0;i < k-1;i ++ {
		fmt.Print(row[i].Idx," ")
	}
	fmt.Print(row[k -1 ].Idx,"\n")
	for i := 0;i < l-1;i ++ {
		fmt.Print(col[i].Idx," ")
	}
	fmt.Print(col[l -1 ].Idx,"\n")

}

func next_per(){
	var n int
	var m int
	fmt.Scan(&n,&m)
	a :=make([]int, n)
	for i:=0;i <n;i++{
		fmt.Scan(&a[i])
	}
	for ;m > 0;m--{
		i := 0
		for i = n-2;i >=0;i --{
			if a[i] < a[i + 1]{
				break
			}

		}
		//t := a[i+1]
		j := 0
		for j = i + 1;j < n;j ++{
			if a[j] <= a[i]{
					break
			}
		}
		a[i],a[j-1] = a[j-1],a[i]
		sort.Ints(a[i + 1:])

	}
	fmt.Println(a)

}
var s string
var n,ans,length,carry int64
//var ans int
//var length int
//var carry int
//func max(x,y int)int{
//	if x > y{
//		return x
//	}
//	return y
//}
func maxf(x, y int64)int64{
	if x > y {
		return x
	}
	return y
}
func get(k int)int{
	var x int64
	var t int64 = 1
	i := k
	for ;i  >= 0; i -- {
		if x + maxf(int64(1), (int64)(s[i]-'0')) * int64(t) >=n{
			break
		}
		x += int64(s[i]-'0') * t
		t *= 10
	}
	for ;s[i+ 1] == '0'&& i < k-1;i ++{

	}
	ans += x * carry
	return i
}
func qq(){

	carry = 1
	fmt.Scan(&n, &s)
	i := len(s) - 1
	for ;i >=0;{
		i = get(i)
		carry *=n
	}
	fmt.Println( ans)

}

func main(){
	//a := [][]int{{28,4,-19,18,-7,-10,27,19,1,16,0,10,-17,11,11,27,-1,10,12,-1},
	//	{-2,-19,17,4,25,-20,4,3,4,28,-10,7,16,-14,-3,-19,6,17,-4,-7},
	//	{2,8,18,-17,-2,10,-6,-5,11,10,22,-6,19,-16,6,-4,18,5,22,-17},
	//	{-14,-7,-20,13,-19,-20,-15,21,-11,-10,-8,-9,10,13,6,-10,15,9,-15,-2},
	//	{-18,26,12,8,2,16,-17,12,0,-5,9,-3,-12,-11,3,-6,-18,16,-7,-14},
	//	{5,29,25,22,11,-3,-2,-15,4,13,-17,-2,0,-2,20,10,-18,6,25,-20},
	//	{5,-7,8,5,15,22,8,-5,22,-18,-5,-14,23,2,-8,12,-16,-18,12,-12},
	//	{27,18,4,11,-3,12,-4,-8,-3,25,-9,24,-14,5,11,-9,-17,0,25,-15},
	//	{26,-7,18,4,4,18,-17,9,-19,-9,-19,-8,-4,-13,10,-11,6,-16,-12,12},
	//	{28,22,7,11,-6,13,8,22,7,-14,17,14,10,29,16,9,-3,18,-9,10},
	//	{27,19,-10,-9,1,3,14,1,7,3,-3,16,-2,9,14,-7,-19,-5,23,19},
	//	{-17,7,-20,8,-5,-6,-2,25,29,16,23,4,4,27,16,17,9,20,-6,22},
	//	{2,9,-13,1,-18,25,4,7,25,26,-4,8,-19,18,6,-7,-5,7,21,-8},
	//	{-2,11,1,29,6,-16,-8,3,7,11,10,-2,-1,-20,20,4,19,5,29,-7},
	//	{29,-12,-3,17,6,19,23,12,-19,13,19,5,27,22,-17,27,10,-12,12,23},
	//	{24,16,4,25,15,13,24,-19,1,-7,-19,13,-13,14,13,26,9,18,-9,-18},
	//	{-17,4,-18,-18,-19,3,-13,12,23,-17,-10,-20,14,2,18,21,-12,27,-3,4},
	//	{27,13,12,14,16,-9,-2,-15,-20,8,-2,24,18,15,26,21,27,17,-15,-3},
	//	{25,-8,17,-10,-16,13,26,-11,-15,6,-5,-13,23,2,24,-4,5,8,-15,-1},
	//	{15,-12,18,5,-3,7,5,11,-4,-13,28,20,0,-4,-13,-5,-13,-8,-16,3}}

	//log.Println(find_last_le_idx(a, 3))
	//log.Println(q(a, -123))

	//aa := []int{2,3,1,3,4,6,1,2}
	//mm(aa, 1)
	//ini()
//inii()
	//next_per()
	qq()
}


package main

import (
	"fmt"
)

func main() {
	var n, o int
	fmt.Scanln(&n)
	if n%2 != 0 {
		o = 0
	} else {
		if n%4 == 0 {
			o = n/4 - 1
		} else {
			o = n / 4
		}
	}
	fmt.Println(o)
}


package main
import (
	"fmt"
)
func max(a,b int) int{
	if a>b {
		return a
	} else {
		return b
	}
}

func abs(n int)int {
	if n<0 {
		n*=(-1)
	}
	return n
}
func main() {
	var r1,c1,r2,c2,l,s,k int
	fmt.Scan(&r1,&c1,&r2,&c2)
	if r1==r2 || c1==c2 {
		l=1
	} else {
		l=2
	}
	if abs(r2-r1)==abs(c2-c1) {
		s=1
	} else if (r1+c1)%2==(r2+c2)%2 {
		s=2
	} else {
		s=0
	}
	k=max(abs(r2-r1),abs(c2-c1))
	fmt.Println(l,s,k)
}


package main

import (
	"fmt"
)

func main() {
	var a, b, n, rest, result int
	fmt.Scanln(&a)
	fmt.Scanln(&b)
	n = a - b
	if n < 0 {
		n = -n
	}
	rest = n % 2
	n /= 2
	result = n*(n+1) + rest*(n+1)
	fmt.Println(result)
}


package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, d, x, p1, p2, count int
	arr := make([]int, 0)
	fmt.Scan(&n, &d)
	for i := 0; i < n; i++ {
		fmt.Scan(&x)
		arr = append(arr, x)
	}

	sort.Ints(arr)
	p1 = 0
	p2 = 0
	count = 1
	for p2 < n && p1 < n {
		for p2 < n && arr[p2]-arr[p1] <= d {
			p2++
		}

		if p2-p1 > count {
			count = p2 - p1
		}

		p1++
	}
	fmt.Printf("%d", n-count)
}


package main

import (
	"fmt"
)

func main() {
	var n, m int
	fmt.Scan(&n)
	fmt.Scan(&m)
	var rows, cols string
	fmt.Scan(&rows)
	fmt.Scan(&cols)
	var tl, tr, bl, br bool

	for i := 0; i < n; i++ {
		var direction = rows[i]
		if i == 0 {
			switch direction {
			case '>':
				tr = true
			case '<':
				tl = true
			}
		}
		if i == n-1 {
			switch direction {
			case '>':
				br = true
			case '<':
				bl = true
			}
		}
	}

	for i := 0; i < m; i++ {
		var direction = cols[i]
		if i == 0 {
			switch direction {
			case 'v':
				bl = true
			case '^':
				tl = true
			}
		}
		if i == m-1 {
			switch direction {
			case 'v':
				br = true
			case '^':
				tr = true
			}
		}
	}
	if tl && tr && bl && br {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main

import (
	"fmt"
)

func main() {
	const formod = 1000000007
	var n, k int
	var dp [2001][2001]int

	fmt.Scan(&n, &k)

	for i := 1; i <= n; i++ {
		dp[1][i] = 1
	}

	for i := 1; i < k; i++ {
		for j := 1; j <= n; j++ {
			for k := j; k <= n; k += j {
				dp[i + 1][k] = (dp[i + 1][k] + dp[i][j]) % formod
			}
		}
	}

	var ans int
	ans = 0

	for i := 1; i <= n; i++ {
		ans = (ans + dp[k][i]) % formod
	}
	fmt.Println(ans)
}


package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d\n", &n)

	if n == 0 {
		fmt.Println(1)
	} else {
		switch n % 4 {
		case 1:
			fmt.Println(8)
		case 2:
			fmt.Println(4)
		case 3:
			fmt.Println(2)
		case 0:
			fmt.Println(6)
		}
	}
}


package main

import "fmt"

func abs(a int) int {
    if a < 0 {
        return -a
    }
    return a
}

func main() {
    var n, m, k int
    fmt.Scan(&n, &m, &k)

    minDist := 10000000 //value big enough
    for i:=1; i<=n; i++ {
        var price int
        fmt.Scan(&price)
        if price == 0 || price > k {
            continue
        }
        dist := abs(m-i)*10
        if minDist > dist {
            minDist = dist
        }
    }
    fmt.Print(minDist)
}


// Try Codeforces
// author: Leonardone @ NEETSDKASU
package main

import "fmt"

func main() {
	var m, b uint64
	fmt.Scan(&m, &b)
	max := uint64(0)
	for x := uint64(0); x <= m*b; x += m {
		y := (m*b - x) / m
		s1 := (y + 1) * x * (x + 1) / 2
		s2 := (x + 1) * y * (y + 1) / 2
		s := s1 + s2
		if s > max {
			max = s
		}
	}
	fmt.Println(max)
}


package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func scan(a ...interface{})             { fmt.Fscan(reader, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }

func redirectInputToFile(r *bufio.Reader, fp string) {
	f, err := os.Open(fp)
	if err != nil {
		panic(err)
	}
	r.Reset(f)
}

func main() {
	defer writer.Flush()
	// redirectInputToFile(reader, "input.txt")

	T := 1
	// scan(&T)
	for t := 0; t < T; t++ {
		solve()
	}
}

type ll = int64

func reverse(a ll) ll {
	var b ll
	for a > 0 {
		b <<= 1
		b |= a & 1
		a >>= 1
	}
	return b
}

func isSorted(s string) bool {
	for i := 1; i < len(s); i++ {
		if s[i-1] > s[i] {
			return false
		}
	}
	return true
}

func tryFor(x, y ll) bool {
	sx, sy := strconv.FormatInt(x, 2), strconv.FormatInt(y, 2)
	if len(sy) < 60 {
		sy = strings.Repeat("0", 60-len(sy)) + sy
	}
	for i := 0; i+len(sx)-1 < len(sy); i++ {
		prefixSorted := isSorted(sy[:i])
		middle := sy[i : i+len(sx)]
		suffix := sy[i+len(sx):]
		onesOnSuffix := strings.Repeat("1", len(sy)-i-len(sx))
		if prefixSorted && middle == sx && suffix == onesOnSuffix {
			return true
		}
	}
	return false
}

func solve() {
	var x, y ll
	scan(&x, &y)

	if x == y {
		printf("YES\n")
		return
	}

	try := []ll{}
	if x&1 == 1 {
		try = append(try, x, reverse(x))
	} else {
		try = append(try,
			reverse(x<<1), reverse(reverse(x<<1)),
			reverse((x<<1)|1), reverse(reverse((x<<1)|1)),
		)
	}

	ok := false
	for _, i := range try {
		ok = ok || tryFor(i, y)
	}

	if !ok {
		printf("NO\n")
	} else {
		printf("YES\n")
	}
}


package main

import (
	"fmt"
)

type Pont struct {
	x, y int32
}

func (o *Pont) read() {
	fmt.Scan(&o.x)
	fmt.Scan(&o.y)
}

func (o *Pont) add(oo Pont) {
	o.x += oo.x
	o.y += oo.y
}

func (o *Pont) eq(oo Pont) bool {
	return o.x == oo.x && o.y == oo.y
}

func isRA(A, B, C Pont) bool {
	AB := Pont{B.x - A.x, B.y - A.y}
	AC := Pont{C.x - A.x, C.y - A.y}
	return 0 == AB.x*AC.x+AB.y*AC.y
}

func isRATRI(A, B, C Pont) bool {
	if A.eq(B) || A.eq(C) || B.eq(C) {
		return false
	}
	return isRA(A, B, C) || isRA(B, A, C) || isRA(C, A, B)
}

func main() {

	var (
		P     [3]Pont
		dir   = [4]Pont{Pont{0, 1}, Pont{1, -1}, Pont{-1, -1}, Pont{-1, 1}}
		delta = Pont{1, 0}
		i, j  int32
	)

	P[0].read()
	P[1].read()
	P[2].read()
	if isRATRI(P[0], P[1], P[2]) {
		fmt.Println("RIGHT")
		return
	}

	almost := false

outer:
	for i = 0; i < 3; i++ {
		for j = 0; j < 4; j++ {
			P[i].add(dir[j])
			//			fmt.Println(P)
			if isRATRI(P[0], P[1], P[2]) {
				almost = true
				break outer
			}
		}
		// ez a j-s ciklusban volt
		P[i].add(delta)

	}

	if almost {
		fmt.Println("ALMOST")

	} else {
		fmt.Println("NEITHER")
	}

}


/*
URL:
https://codeforces.com/problemset/problem/678/C
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n, a, b, p, q int64
)

func main() {
	n = ReadInt64()
	a, b, p, q = ReadInt64_4()

	red := n / a
	red *= p

	blue := n / b
	blue *= q

	ans := red + blue

	c := Lcm(a, b)
	tmp := n / c
	tmp *= Min(p, q)

	ans -= tmp
	fmt.Println(ans)
}

// Min returns the min integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Min(integers ...int64) int64 {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m > integer {
			m = integer
		}
	}
	return m
}

// Gcd returns the Greatest Common Divisor of two natural numbers.
// Gcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Gcd uses the Euclidean Algorithm.
func Gcd(a, b int64) int64 {
	if a < 0 || b < 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}

	if a == 0 {
		return b
	}
	if b == 0 {
		return a
	}

	if a < b {
		a, b = b, a
	}

	// Euclidean Algorithm
	for b > 0 {
		div := a % b
		a, b = b, div
	}

	return a
}

// Lcm returns the Least Common Multiple of two natural numbers.
// Lcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Lcd uses the Euclidean Algorithm indirectly.
func Lcm(a, b int64) int64 {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}

	// a = a'*gcd, b = b'*gcd, a*b = a'*b'*gcd^2
	// a' and b' are relatively prime numbers
	// gcd consists of prime numbers, that are included in a and b
	gcd := Gcd(a, b)

	// not (a * b / gcd), because of reducing a probability of overflow
	return (a / gcd) * b
}

// NegativeMod can calculate a right residual whether value is positive or negative.
func NegativeMod(val, m int64) int64 {
	res := val % m
	if res < 0 {
		res += m
	}
	return res
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}