Vasya has several phone books, in which he recorded the telephone numbers of his friends. Each of his friends can have one or several phone numbers.Vasya decided to organize information about the phone numbers of friends. You will be given n strings — all entries from Vasya's phone books. Each entry starts with a friend's name. Then follows the number of phone numbers in the current entry, and then the phone numbers themselves. It is possible that several identical phones are recorded in the same record.Vasya also believes that if the phone number a is a suffix of the phone number b (that is, the number b ends up with a), and both numbers are written by Vasya as the phone numbers of the same person, then a is recorded without the city code and it should not be taken into account.The task is to print organized information about the phone numbers of Vasya's friends. It is possible that two different people have the same number. If one person has two numbers x and y, and x is a suffix of y (that is, y ends in x), then you shouldn't print number x. If the number of a friend in the Vasya's phone books is recorded several times in the same format, it is necessary to take it into account exactly once.Read the examples to understand statement and format of the output better.

First line contains the integer n (1 ≤ n ≤ 20) — number of entries in Vasya's phone books.  The following n lines are followed by descriptions of the records in the format described in statement. Names of Vasya's friends are non-empty strings whose length does not exceed 10. They consists only of lowercase English letters. Number of phone numbers in one entry is not less than 1 is not more than 10. The telephone numbers consist of digits only. If you represent a phone number as a string, then its length will be in range from 1 to 10. Phone numbers can contain leading zeros.

Print out the ordered information about the phone numbers of Vasya's friends. First output m — number of friends that are found in Vasya's phone books. The following m lines must contain entries in the following format "name number_of_phone_numbers phone_numbers". Phone numbers should be separated by a space. Each record must contain all the phone numbers of current friend. Entries can be displayed in arbitrary order, phone numbers for one record can also be printed in arbitrary order.

//package codeforces
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strings"
)

func readIntoMap(r io.Reader) {
	entries := map[string][]string{}
	for scan := bufio.NewScanner(r); scan.Scan(); {
		if txt := scan.Text(); len(txt) > 2 {
			s := strings.Split(txt, " ")
			if _, ok := entries[s[0]]; ok {
				appendUnique(s[0], s[2:], entries)
			} else {
				entries[s[0]] = s[2:]
			}
		}
	}

	filterPhoneBook(entries)
	removeSuffix(entries)
	printer(entries)
}

func appendUnique(k string, arr []string, e map[string][]string) {
	uniq := map[string]bool{}

	for i := range e[k] {
		uniq[e[k][i]] = true
	}

	for j := range arr {
		uniq[arr[j]] = true
	}

	e[k] = []string{}
	for key := range uniq {
		e[k] = append(e[k], key)
	}
}

func filterPhoneBook(e map[string][]string) {
	for k := range e {
		arr := e[k]
		sort.Slice(arr, func(i, j int) bool {
			return len(arr[i]) < len(arr[j])
		})

		e[k] = arr
	}
}

func removeSuffix(e map[string][]string) {
	for k := range e {
		for i := 0; i < len(e[k]); i++ {
			for j := 1 + i; ; j++ {
				if j == len(e[k]) {
					break
				}

				if strings.HasSuffix(e[k][j], e[k][i]) {
					e[k][i] = ""
					break
				}
			}
		}
	}
}

func shrink(e map[string][]string) {
	for k := range e {
		s := []string{}
		for i := range e[k] {
			if e[k][i] != "" {
				s = append(s, e[k][i])
			}
		}
		e[k] = s
	}
}

func printer(e map[string][]string) {
	shrink(e)
	fmt.Println(len(e))
	for k, v := range e {
		fmt.Printf("%v %v ", k, len(v))
		for i := range v {
			if v[i] != "" {
				fmt.Printf("%v ", v[i])
			}
		}
		fmt.Printf("\n")
	}
}

func main() {
	readIntoMap(os.Stdin)
}

package main

import (
  "fmt"
  "strings"
  "sort"
)

var n, num int
var name, phone string
var ans = map[string][]string{}
var flag bool

type ByLen []string

func (a ByLen) Len() int {
  return len(a)
}

func (a ByLen) Less(i, j int) bool {
  return len(a[i]) < len(a[j])
}

func (a ByLen) Swap(i, j int) {
  a[i], a[j] = a[j], a[i]
}

func main() {
  fmt.Scan(&n)
  for entry := 0; entry < n; entry++ {
    fmt.Scan(&name)
    fmt.Scan(&num)
    for i := 0; i < num; i++ {
      fmt.Scan(&phone)
      ans[name] = append(ans[name], phone)
    }
  }
  fmt.Println(len(ans))
  for k, v := range ans {
    sort.Sort(ByLen(v))
    var filterred = []string{}
    for i := len(v) - 1; i >= 0; i-- {
      flag = false
      for j := i + 1; j < len(v); j++ {
        if strings.HasSuffix(v[j], v[i]) {
          flag = true
          break
        }
      }
      if !flag {
        filterred = append(filterred, v[i])
      }
    }
    fmt.Printf("%v %v", k, len(filterred))
    for _, value := range filterred {
      fmt.Printf(" %v", value)
    }
    fmt.Print("\n")
  }
}

package main

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

type person struct {
	name   string
	phones []string
}

func solve() {
	n := readInt()
	book := make(map[string]*person)
	for i := 0; i < n; i++ {
		name := readString()
		k := readInt()
		p, ok := book[name]
		if !ok {
			p = &person{name: name}
			book[name] = p
		}
		for j := 0; j < k; j++ {
			p.phones = append(p.phones, readString())
		}
	}
	for _, p := range book {
		sort.Sort(ByLength(p.phones))
		a := make([]string, 0)
		for i := 0; i < len(p.phones); i++ {
			ok := true
			for j := 0; j < len(a); j++ {
				if strings.HasSuffix(a[j], p.phones[i]) {
					ok = false
					break
				}
			}
			if ok {
				a = append(a, p.phones[i])
			}
		}
		p.phones = a
	}
	fmt.Println(len(book))
	names := make([]string, 0)
	for name, _ := range book {
		names = append(names, name)
	}
	sort.Strings(names)
	for _, name := range names {
		p := book[name]
		fmt.Println(name, len(p.phones), strings.Join(p.phones, " "))
	}
}

type ByLength []string

func (s ByLength) Len() int {
	return len(s)
}
func (s ByLength) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}
func (s ByLength) Less(i, j int) bool {
	if len(s[i]) == len(s[j]) {
		return strings.Compare(s[i], s[j]) < 0
	}
	return len(s[i]) > len(s[j])
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

// IO

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

func readInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		res[i] = readInt64()
	}
	return res
}

func max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

func min(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

//package codeforces

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strings"
)

type array struct {
	slice []string
	check map[string]bool
}

func (a *array) insert(s string) {
	if a.slice == nil {
		a.slice = make([]string, 0)
		a.check = map[string]bool{}
	}
	_, ok := a.check[s]
	if !ok {
		a.slice = append(a.slice, s)
		a.check[s] = true
	} else {
		return
	}

	if sort.StringsAreSorted(a.slice) {
		return
	}

	sort.Slice(a.slice, func(i, j int) bool {
		return len(a.slice[i]) < len(a.slice[j])
	})
}

func readIntoMap(r io.Reader) {
	entries := map[string]array{}
	for scan := bufio.NewScanner(r); scan.Scan(); {
		if txt := scan.Text(); len(txt) > 2 {
			s := strings.Split(txt, " ")
			e := entries[s[0]]
			a := s[2:]
			for i := 0; i < len(a); i++ {
				e.insert(a[i])
			}
			entries[s[0]] = e
		}
	}

	removeSuffix(entries)
	printer(entries)
}

func removeSuffix(entries map[string]array) {
	for k := range entries {
		e := entries[k].slice
		for i := 0; i < len(e); i++ {
			for j := i + 1; ; j++ {
				if j == len(e) {
					break
				}
				if strings.HasSuffix(e[j], e[i]) {
					e[i] = ""
				}
			}
		}
		et := entries[k]
		et.slice = e
		entries[k] = et
	}
}

func count(a []string) []string {
	r := []string{}
	for i := range a {
		if a[i] != "" {
			r = append(r, a[i])
		}
	}

	return r
}

func printer(entries map[string]array) {
	fmt.Println(len(entries))
	for k := range entries {
		slice := count(entries[k].slice)
		fmt.Printf("%v %v ", k, len(slice))
		for i := 0; i < len(slice); i++ {
			fmt.Printf("%v ", slice[i])
		}
		fmt.Printf("\n")
	}
}

// code
func main() {
	readIntoMap(os.Stdin)
}

//package codeforces
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strings"
)

func readIntoMap(r io.Reader) {
	entries := map[string][]string{}
	for scan := bufio.NewScanner(r); scan.Scan(); {
		if txt := scan.Text(); len(txt) > 2 {
			s := strings.Split(txt, " ")
			if _, ok := entries[s[0]]; ok {
				appendUnique(s[0], s[2:], entries)
			} else {
				entries[s[0]] = s[2:]
			}
		}
	}

	filterPhoneBook(entries)
	removeSuffix(entries)
	printer(entries)
}

func appendUnique(k string, arr []string, e map[string][]string) {
	uniq := map[string]bool{}

	for i := range e[k] {
		uniq[e[k][i]] = true
	}

	for j := range arr {
		uniq[arr[j]] = true
	}

	e[k] = []string{}
	for key := range uniq {
		e[k] = append(e[k], key)
	}
}

func filterPhoneBook(e map[string][]string) {
	for k := range e {
		arr := e[k]
		sort.Slice(arr, func(i, j int) bool {
			return len(arr[i]) < len(arr[j])
		})

		e[k] = arr
	}
}

func removeSuffix(e map[string][]string) {
	for k := range e {
		for i := 0; i < len(e[k]); i++ {
			for j := 1 + i; ; j++ {
				if j == len(e[k]) {
					break
				}

				if strings.HasSuffix(e[k][j], e[k][i]) {
					e[k][i] = ""
					break
				}
			}
		}
	}
}

func shrink(e map[string][]string) {
	for k := range e {
		s := []string{}
		for i := range e[k] {
			if e[k][i] != "" {
				s = append(s, e[k][i])
			}
		}
		e[k] = s
	}
}

func printer(e map[string][]string) {
	shrink(e)
	for k, v := range e {
		fmt.Printf("%v %v ", k, len(v))
		for i := range v {
			if v[i] != "" {
				fmt.Printf("%v ", v[i])
			}
		}
		fmt.Printf("\n")
	}
}

func main() {
	readIntoMap(os.Stdin)
}

//package codeforces

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strings"
)

type array struct {
	slice []string
	check map[string]bool
}

func (a *array) insert(s string) {
	if a.slice == nil {
		a.slice = make([]string, 0)
		a.check = map[string]bool{}
	}
	_, ok := a.check[s]
	if !ok {
		a.slice = append(a.slice, s)
		a.check[s] = true
	}
	sort.Slice(a.slice, func(i, j int) bool {
		return len(a.slice[i]) < len(a.slice[j])
	})
}

func readIntoMap(r io.Reader) {
	entries := map[string]array{}
	for scan := bufio.NewScanner(r); scan.Scan(); {
		if txt := scan.Text(); len(txt) > 2 {
			s := strings.Split(txt, " ")
			e := entries[s[0]]
			a := s[2:]
			for i := 0; i < len(a); i++ {
				e.insert(a[i])
			}
			entries[s[0]] = e
		}
	}

	removeSuffix(entries)
	printer(entries)
}

func removeSuffix(entries map[string]array) {
	for k := range entries {
		e := entries[k].slice
		for i := 0; i < len(e); i++ {
			for j := i + 1; ; j++ {
				if j == len(e) {
					break
				}
				if strings.HasSuffix(e[j], e[i]) {
					e[i] = ""
				}
			}
		}
		et := entries[k]
		et.slice = e
		entries[k] = et
	}
}

func printer(entries map[string]array) {
	fmt.Println(len(entries))
	for k := range entries {
		fmt.Printf("%v ", k)
		for i := 0; i < len(entries[k].slice); i++ {
			if entries[k].slice[i] != "" {
				fmt.Printf("%v ", entries[k].slice[i])
			}
		}
		fmt.Printf("\n")
	}
}

// code
func main() {
	readIntoMap(os.Stdin)
}

//package codeforces

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strings"
)

type array struct {
	slice []string
	check map[string]bool
}

func (a *array) insert(s string) {
	if a.slice == nil {
		a.slice = make([]string, 0)
		a.check = map[string]bool{}
	}
	_, ok := a.check[s]
	if !ok {
		a.slice = append(a.slice, s)
		a.check[s] = true
	}
	sort.Slice(a.slice, func(i, j int) bool {
		return len(a.slice[i]) < len(a.slice[j])
	})
}

func readIntoMap(r io.Reader) {
	entries := map[string]array{}
	for scan := bufio.NewScanner(r); scan.Scan(); {
		if txt := scan.Text(); len(txt) > 2 {
			s := strings.Split(txt, " ")
			e := entries[s[0]]
			a := s[2:]
			for i := 0; i < len(a); i++ {
				e.insert(a[i])
			}
			entries[s[0]] = e
		}
	}

	removeSuffix(entries)
	printer(entries)
}

func removeSuffix(entries map[string]array) {
	for k := range entries {
		e := entries[k].slice
		for i := 0; i < len(e); i++ {
			for j := i + 1; ; j++ {
				if j == len(e) {
					break
				}
				if strings.HasSuffix(e[j], e[i]) {
					e[i] = ""
				}
			}
		}
		et := entries[k]
		et.slice = e
		entries[k] = et
	}
}

func printer(entries map[string]array) {
	fmt.Println(len(entries))
	for k := range entries {
		fmt.Printf("%v ", k)
		for i := 0; i < len(entries[k].slice); i++ {
			if entries[k].slice[i] != "" {
				fmt.Printf("%v ", entries[k].slice[i])
			}
		}
		fmt.Printf("\n")
	}
}

func main() {
	readIntoMap(os.Stdin)
}

package main

import (
  "fmt"
  "strings"
  "sort"
)

var n, num int
var name, phone string
var ans = map[string][]string{}
var flag bool

func main() {
  fmt.Scan(&n)
  for entry := 0; entry < n; entry++ {
    fmt.Scan(&name)
    fmt.Scan(&num)
    for i := 0; i < num; i++ {
      fmt.Scan(&phone)
      ans[name] = append(ans[name], phone)
    }
  }
  fmt.Println(len(ans))
  for k, v := range ans {
    sort.Sort(sort.StringSlice(v))
    var filterred = []string{}
    for i := len(v) - 1; i >= 0; i-- {
      flag = false
      for j := i + 1; j < len(v); j++ {
        if strings.HasSuffix(v[j], v[i]) {
          flag = true
          break
        }
      }
      if !flag {
        filterred = append(filterred, v[i])
      }
    }
    fmt.Printf("%v %v", k, len(filterred))
    for _, value := range filterred {
      fmt.Printf(" %v", value)
    }
    fmt.Print("\n")
  }
}


Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it will go along a circle around this point and will remove all the snow from its path.Formally, we assume that Peter's machine is a polygon on a plane. Then, after the machine is switched on, it will make a circle around the point to which Peter tied it (this point lies strictly outside the polygon). That is, each of the points lying within or on the border of the polygon will move along the circular trajectory, with the center of the circle at the point to which Peter tied his machine.Peter decided to tie his car to point P and now he is wondering what is the area of the region that will be cleared from snow. Help him.

The first line of the input contains three integers — the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integers — coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on a common straight line. All the numbers in the input are integers that do not exceed 1 000 000 in their absolute value.

Print a single real value number — the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6.  Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .

NoteIn the first sample snow will be removed from that area:

package main

import (
	"bufio"
	. "fmt"
	"io"
	"math"
	"os"
)

const eps = 1e-6

type vec struct {
	x, y float64
}

func (a vec) add(b vec) vec     { return vec{a.x + b.x, a.y + b.y} }
func (a vec) sub(b vec) vec     { return vec{a.x - b.x, a.y - b.y} }
func (a vec) mul(k float64) vec { return vec{a.x * k, a.y * k} }
func (a vec) len2() float64     { return a.x*a.x + a.y*a.y }
func (a vec) dot(b vec) float64 { return a.x*b.x + a.y*b.y }
func (a vec) det(b vec) float64 { return a.x*b.y - a.y*b.x }

type line struct {
	p1, p2 vec
}

func (a vec) perpendicular(l line) line {
	return line{a, a.add(vec{l.p1.y - l.p2.y, l.p2.x - l.p1.x})}
}

func (a line) intersection(b line) vec {
	va, vb := a.p2.sub(a.p1), b.p2.sub(b.p1)
	k := vb.det(b.p1.sub(a.p1)) / vb.det(a.p2.sub(a.p1))
	return a.p1.add(va.mul(k))
}

func (a vec) onSeg(l line) bool {
	p1 := l.p1.sub(a)
	p2 := l.p2.sub(a)
	return math.Abs(p1.det(p2)) < eps && p1.dot(p2) < eps
}

func (a vec) disToSeg(l line) float64 {
	p := l.intersection(a.perpendicular(l))
	if !p.onSeg(l) {
		if l.p2.sub(l.p1).dot(p.sub(l.p1)) < -eps {
			p = l.p1
		} else {
			p = l.p2
		}
	}
	return a.sub(p).len2()
}

// github.com/EndlessCheng/codeforces-go
func Sol613A(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var n int
	var o vec
	Fscan(in, &n, &o.x, &o.y)
	minD2, maxD2 := 1e18, 0.0
	ps := make([]vec, n)
	for i := range ps {
		Fscan(in, &ps[i].x, &ps[i].y)
		ps[i] = ps[i].sub(o)
		if d2 := ps[i].len2(); d2 > maxD2 {
			maxD2 = d2
		}
	}
	ls := make([]line, n)
	for i := 0; i < n-1; i++ {
		ls[i] = line{ps[i], ps[i+1]}
	}
	ls[n-1] = line{ps[n-1], ps[0]}
	for _, l := range ls {
		if d2 := (vec{0, 0}).disToSeg(l); d2 < minD2 {
			minD2 = d2
		}
	}
	Fprintf(out, "%.18f", (maxD2-minD2)*math.Pi)
}

func main() {
	Sol613A(os.Stdin, os.Stdout)
}

package main

import (
         "bufio"
         "os"
         "fmt"
         "strconv"
         "bytes"
         "math"
       )

type vertex struct {
    x float64
    y float64
}

type vertices []vertex

func dist(pfx, pfy float64, vi, vj *vertex) float64 {
    x1 := (*vi).x
    y1 := (*vi).y
    x2 := (*vj).x
    y2 := (*vj).y

    if x1 == x2 && y1 == y2 {
        return math.Hypot(x1, y1)
    }

    var h float64
    dd := (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)
    z := ((pfx - x1) * (x2 - x1) + (pfy - y1) * (y2 - y1)) / dd
    if z < 0.0 {
        h = math.Hypot(x1 - pfx, y1 - pfy)
    } else if z > 1.0 {
        h = math.Hypot(x2 - pfx, y2 - pfy)
    } else {
        hx := x1 + z * (x2 - x1)
        hy := y1 + z * (y2 - y1)
        h = math.Hypot(hx - pfx, hy - pfy)
    }
    return h
}

func main() {
    stin := bufio.NewReader(os.Stdin)
    var tmp []byte
    tmp,_ = stin.ReadBytes(' ')
    n,_ := strconv.Atoi(string(bytes.Trim(tmp," ")))
    tmp,_ = stin.ReadBytes(' ')
    px,_ := strconv.ParseFloat(string(bytes.Trim(tmp," ")), 64)
    tmp,_ = stin.ReadBytes('\n')
    py,_ := strconv.ParseFloat(string(bytes.Trim(tmp,"\n\r")), 64)
    //fmt.Printf("%v %v %v\n", n, px, py)

    var v vertices = make(vertices, n)
    minDistance := float64(1.0e18)
    maxDistance := float64(0.0)
    for i := 0; i < n; i++ {
        tmp,_ = stin.ReadBytes(' ')
        x,_ := strconv.ParseFloat(string(bytes.Trim(tmp," ")), 64)
        tmp,_ = stin.ReadBytes('\n')
        y,_ := strconv.ParseFloat(string(bytes.Trim(tmp,"\n\r")), 64)
        //fmt.Printf("%v %v\n", x, y)
        d := math.Hypot(px-x, py-y)
        if d > maxDistance {
            maxDistance = d
        }
        if d < minDistance {
            minDistance = d
        }
        v[i] = vertex{x:x, y:y}
    }
    //fmt.Printf("%v", v)

    for i := 0; i < n; i++ {
        j := (i + 1)%n
        h := dist(px, py, &v[i], &v[j])
        if h < minDistance {
            minDistance = h
        }
    }
    fmt.Printf("%.12f\n", (maxDistance*maxDistance - minDistance*minDistance) * math.Pi)
}

package main

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

var scanner *bufio.Scanner

func getI64() int64 {
  scanner.Scan()
  x, _ := strconv.ParseInt(scanner.Text(), 10, 64)
  return x
}
func getI() int {
  return int(getI64())
}
func getF() float64 {
  scanner.Scan()
  x, _ := strconv.ParseFloat(scanner.Text(), 64)
  return x
}
func getS() string {
  scanner.Scan()
  return scanner.Text()
}

func main() {
  scanner = bufio.NewScanner(os.Stdin)
  scanner.Split(bufio.ScanWords)
  writer := bufio.NewWriter(os.Stdout)
  defer writer.Flush()

  n, x0, y0 := getI(), getF(), getF()
  rMax := 0.0
  xy := make([][]float64, n)
  for i := range xy {
    x, y := getF(), getF()
    r := math.Hypot(x - x0, y - y0)
    if r > rMax {
      rMax = r
    }
    xy[i] = []float64{ x, y }
  }

  rMin := 1000.0 * 1000.0
  for i := range xy {
    j := (i + 1) % n
    x1, y1, x2, y2 := xy[i][0], xy[i][1], xy[j][0], xy[j][1]
    var r float64
    if x1 == x2 && y1 == y2 {
      r = math.Hypot(x1, y1)
    } else {
      dd := (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)
      t := ((x0 - x1) * (x2 - x1) + (y0 - y1) * (y2 - y1)) / dd
      //writer.WriteString(fmt.Sprintf("dd %f, t %f\n", dd, t))
      if t < 0.0 {
        r = math.Hypot(x1 - x0, y1 - y0)
      } else if t > 1.0 {
        r = math.Hypot(x2 - x0, y2 - y0)
      } else {
        x := x1 + t * (x2 - x1)
        y := y1 + t * (y2 - y1)
        r = math.Hypot(x - x0, y - y0)
      }
    }
    //writer.WriteString(fmt.Sprintf("(%f, %f) (%f, %f) %f\n\n",
    //    x1, y1, x2, y2, r))
    if r < rMin {
      rMin = r
    }
  }

  //writer.WriteString(fmt.Sprintf("%f %f\n", rMin, rMax))
  writer.WriteString(fmt.Sprintf("%.12f\n",
    (rMax * rMax - rMin * rMin) * math.Pi))
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"math"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func Sol613A(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var n int
	var ox, oy, x, y int64
	Fscan(in, &n, &ox, &oy)
	minD2, maxD2 := int64(1e18), int64(0)
	for i := 0; i < n; i++ {
		Fscan(in, &x, &y)
		x -= ox
		y -= oy
		d2 := x*x + y*y
		if d2 < minD2 {
			minD2 = d2
		}
		if d2 > maxD2 {
			maxD2 = d2
		}
	}
	Fprintf(out, "%.18f", float64(maxD2-minD2)*math.Pi)
}

func main() {
	Sol613A(os.Stdin, os.Stdout)
}

package main

import (
         "bufio"
         "os"
         "fmt"
         "strconv"
         "bytes"
         "math"
       )

type vertex struct {
    x float64
    y float64
}

type vertices []vertex

func dist(pfx, pfy float64, vi, vj *vertex) float64 {
    x1 := (*vi).x
    y1 := (*vi).y
    x2 := (*vj).x
    y2 := (*vj).y

    var h float64
    dd := (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)
    z := ((pfx - x1) * (x2 - x1) + (pfy - y1) * (y2 - y1)) / dd
    if z < 0.0 {
        h = math.Hypot(x1 - pfx, y1 - pfy)
    } else if z > 1.0 {
        h = math.Hypot(x2 - pfx, y2 - pfy)
    } else {
        hx := x1 + z * (x2 - x1)
        hy := y1 + z * (y2 - y1)
        h = math.Hypot(hx - pfx, hy - pfy)
    }
    return h
}

func main() {
    stin := bufio.NewReader(os.Stdin)
    var tmp []byte
    tmp,_ = stin.ReadBytes(' ')
    n,_ := strconv.Atoi(string(bytes.Trim(tmp," ")))
    tmp,_ = stin.ReadBytes(' ')
    px,_ := strconv.Atoi(string(bytes.Trim(tmp," ")))
    tmp,_ = stin.ReadBytes('\n')
    py,_ := strconv.Atoi(string(bytes.Trim(tmp,"\n\r")))
    //fmt.Printf("%v %v %v\n", n, px, py)

    var v vertices = make(vertices, n)
    minDistance := float64(1.0e18)
    var minDistanceVertex int = -1
    maxDistance := float64(0.0)
    for i := 0; i < n; i++ {
        tmp,_ = stin.ReadBytes(' ')
        x,_ := strconv.Atoi(string(bytes.Trim(tmp," ")))
        tmp,_ = stin.ReadBytes('\n')
        y,_ := strconv.Atoi(string(bytes.Trim(tmp,"\n\r")))
        //fmt.Printf("%v %v\n", x, y)
        d := math.Hypot(float64(px-x), float64(py-y))
        if d > maxDistance {
            maxDistance = d
        }
        if d < minDistance {
            minDistance = d
            minDistanceVertex = i
        }
        v[i] = vertex{x:float64(x), y:float64(y)}
    }
    //fmt.Printf("%v", v)

    i := minDistanceVertex
    j := minDistanceVertex - 1
    if j < 0 {
        j = n-1
    }
    hL := dist(float64(px), float64(py), &v[i], &v[j])
    if hL < minDistance {
        minDistance = hL
    }

    j = (minDistanceVertex + 1)%n
    hR := dist(float64(px), float64(py), &v[i], &v[j])
    if hR < minDistance {
        minDistance = hR
    }
    fmt.Printf("%f\n", math.Pi * (maxDistance*maxDistance - minDistance*minDistance))

}

package main

import (
         "bufio"
         "os"
         "fmt"
         "strconv"
         "bytes"
         "math"
       )

type vertex struct {
    x float64
    y float64
}

type vertices []vertex

func main() {
    stin := bufio.NewReader(os.Stdin)
    var tmp []byte
    tmp,_ = stin.ReadBytes(' ')
    n,_ := strconv.Atoi(string(bytes.Trim(tmp," ")))
    tmp,_ = stin.ReadBytes(' ')
    px,_ := strconv.Atoi(string(bytes.Trim(tmp," ")))
    tmp,_ = stin.ReadBytes('\n')
    py,_ := strconv.Atoi(string(bytes.Trim(tmp,"\n\r")))
    //fmt.Printf("%v %v %v\n", n, px, py)

    var v vertices = make(vertices, n)
    minDistance := float64(1.0e18)
    maxDistance := float64(0.0)
    for i := 0; i < n; i++ {
        tmp,_ = stin.ReadBytes(' ')
        x,_ := strconv.Atoi(string(bytes.Trim(tmp," ")))
        tmp,_ = stin.ReadBytes('\n')
        y,_ := strconv.Atoi(string(bytes.Trim(tmp,"\n\r")))
        //fmt.Printf("%v %v\n", x, y)
        d := math.Sqrt(float64((px-x)*(px-x) + (py-y)*(py-y)))
        if d > maxDistance {
            maxDistance = d
        }
        if d < minDistance {
            minDistance = d
        }
        v[i] = vertex{x:float64(x), y:float64(y)}
    }
    //fmt.Printf("%v", v)
    for i := 0; i < n-1; i++ {
        for j := i+1; j < n; j++ {
            pfx, pfy := float64(px), float64(py)
            x1 := v[i].x
            y1 := v[i].y
            x2 := v[j].x
            y2 := v[j].y

            var h float64
            dd := (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)
            z := ((pfx - x1) * (x2 - x1) + (pfy - y1) * (y2 - y1)) / dd
            if z < 0.0 {
                h = math.Hypot(x1 - pfx, y1 - pfy)
            } else if z > 1.0 {
                h = math.Hypot(x2 - pfx, y2 - pfy)
            } else {
                hx := x1 + z * (x2 - x1)
                hy := y1 + z * (y2 - y1)
                h = math.Hypot(hx - pfx, hy - pfy)
            }
            if h < minDistance {
                minDistance = h
            }
        }
    }
    fmt.Printf("%v\n", math.Pi * (maxDistance*maxDistance - minDistance*minDistance))

}

package main

import (
         "bufio"
         "os"
         "fmt"
         "strconv"
         "bytes"
         "math"
       )

type vertex struct {
    x float64
    y float64
}

type vertices []vertex

func dist(pfx, pfy float64, vi, vj *vertex) float64 {
    x1 := (*vi).x
    y1 := (*vi).y
    x2 := (*vj).x
    y2 := (*vj).y

    var h float64
    dd := (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)
    z := ((pfx - x1) * (x2 - x1) + (pfy - y1) * (y2 - y1)) / dd
    if z < 0.0 {
        h = math.Hypot(x1 - pfx, y1 - pfy)
    } else if z > 1.0 {
        h = math.Hypot(x2 - pfx, y2 - pfy)
    } else {
        hx := x1 + z * (x2 - x1)
        hy := y1 + z * (y2 - y1)
        h = math.Hypot(hx - pfx, hy - pfy)
    }
    return h
}

func main() {
    stin := bufio.NewReader(os.Stdin)
    var tmp []byte
    tmp,_ = stin.ReadBytes(' ')
    n,_ := strconv.Atoi(string(bytes.Trim(tmp," ")))
    tmp,_ = stin.ReadBytes(' ')
    px,_ := strconv.Atoi(string(bytes.Trim(tmp," ")))
    tmp,_ = stin.ReadBytes('\n')
    py,_ := strconv.Atoi(string(bytes.Trim(tmp,"\n\r")))
    //fmt.Printf("%v %v %v\n", n, px, py)

    var v vertices = make(vertices, n)
    minDistance := float64(1.0e18)
    var minDistanceVertex int = -1
    maxDistance := float64(0.0)
    for i := 0; i < n; i++ {
        tmp,_ = stin.ReadBytes(' ')
        x,_ := strconv.Atoi(string(bytes.Trim(tmp," ")))
        tmp,_ = stin.ReadBytes('\n')
        y,_ := strconv.Atoi(string(bytes.Trim(tmp,"\n\r")))
        //fmt.Printf("%v %v\n", x, y)
        d := math.Hypot(float64(px-x), float64(py-y))
        if d > maxDistance {
            maxDistance = d
        }
        if d < minDistance {
            minDistance = d
            minDistanceVertex = i
        }
        v[i] = vertex{x:float64(x), y:float64(y)}
    }
    //fmt.Printf("%v", v)

    i := minDistanceVertex
    j := minDistanceVertex - 1
    if j < 0 {
        j = n-1
    }
    hL := dist(float64(px), float64(py), &v[i], &v[j])
    if hL < minDistance {
        minDistance = hL
    }

    j = (minDistanceVertex + 1)%n
    hR := dist(float64(px), float64(py), &v[i], &v[j])
    if hR < minDistance {
        minDistance = hR
    }
    fmt.Printf("%.8f\n", math.Pi * (maxDistance*maxDistance - minDistance*minDistance))
}

package main

import (
         "bufio"
         "os"
         "fmt"
         "strconv"
         "bytes"
         "math"
       )

type vertex struct {
    x float64
    y float64
}

type vertices []vertex

func dist(pfx, pfy float64, vi, vj *vertex) float64 {
    x1 := (*vi).x
    y1 := (*vi).y
    x2 := (*vj).x
    y2 := (*vj).y

    var h float64
    dd := (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)
    z := ((pfx - x1) * (x2 - x1) + (pfy - y1) * (y2 - y1)) / dd
    if z < 0.0 {
        h = math.Hypot(x1 - pfx, y1 - pfy)
    } else if z > 1.0 {
        h = math.Hypot(x2 - pfx, y2 - pfy)
    } else {
        hx := x1 + z * (x2 - x1)
        hy := y1 + z * (y2 - y1)
        h = math.Hypot(hx - pfx, hy - pfy)
    }
    return h
}

func main() {
    stin := bufio.NewReader(os.Stdin)
    var tmp []byte
    tmp,_ = stin.ReadBytes(' ')
    n,_ := strconv.Atoi(string(bytes.Trim(tmp," ")))
    tmp,_ = stin.ReadBytes(' ')
    px,_ := strconv.Atoi(string(bytes.Trim(tmp," ")))
    tmp,_ = stin.ReadBytes('\n')
    py,_ := strconv.Atoi(string(bytes.Trim(tmp,"\n\r")))
    //fmt.Printf("%v %v %v\n", n, px, py)

    var v vertices = make(vertices, n)
    minDistance := float64(1.0e18)
    var minDistanceVertex int = -1
    maxDistance := float64(0.0)
    for i := 0; i < n; i++ {
        tmp,_ = stin.ReadBytes(' ')
        x,_ := strconv.Atoi(string(bytes.Trim(tmp," ")))
        tmp,_ = stin.ReadBytes('\n')
        y,_ := strconv.Atoi(string(bytes.Trim(tmp,"\n\r")))
        //fmt.Printf("%v %v\n", x, y)
        d := math.Hypot(float64(px-x), float64(py-y))
        if d > maxDistance {
            maxDistance = d
        }
        if d < minDistance {
            minDistance = d
            minDistanceVertex = i
        }
        v[i] = vertex{x:float64(x), y:float64(y)}
    }
    //fmt.Printf("%v", v)

    i := minDistanceVertex
    j := minDistanceVertex - 1
    if j < 0 {
        j = n-1
    }
    hL := dist(float64(px), float64(py), &v[i], &v[j])
    if hL < minDistance {
        minDistance = hL
    }

    j = (minDistanceVertex + 1)%n
    hR := dist(float64(px), float64(py), &v[i], &v[j])
    if hR < minDistance {
        minDistance = hR
    }
    fmt.Printf("%v\n", math.Pi * (maxDistance*maxDistance - minDistance*minDistance))

}

package main

import (
         "bufio"
         "os"
         "fmt"
         "strconv"
         "bytes"
         "math"
       )

type vertex struct {
    x float64
    y float64
}

type vertices []vertex

func dist(pfx, pfy float64, vi, vj *vertex) float64 {
    x1 := (*vi).x
    y1 := (*vi).y
    x2 := (*vj).x
    y2 := (*vj).y

    var h float64
    dd := (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)
    z := ((pfx - x1) * (x2 - x1) + (pfy - y1) * (y2 - y1)) / dd
    if z < 0.0 {
        h = math.Hypot(x1 - pfx, y1 - pfy)
    } else if z > 1.0 {
        h = math.Hypot(x2 - pfx, y2 - pfy)
    } else {
        hx := x1 + z * (x2 - x1)
        hy := y1 + z * (y2 - y1)
        h = math.Hypot(hx - pfx, hy - pfy)
    }
    return h
}

func main() {
    stin := bufio.NewReader(os.Stdin)
    var tmp []byte
    tmp,_ = stin.ReadBytes(' ')
    n,_ := strconv.Atoi(string(bytes.Trim(tmp," ")))
    tmp,_ = stin.ReadBytes(' ')
    px,_ := strconv.Atoi(string(bytes.Trim(tmp," ")))
    tmp,_ = stin.ReadBytes('\n')
    py,_ := strconv.Atoi(string(bytes.Trim(tmp,"\n\r")))
    //fmt.Printf("%v %v %v\n", n, px, py)

    var v vertices = make(vertices, n)
    minDistance := float64(1.0e18)
    var minDistanceVertex int = -1
    maxDistance := float64(0.0)
    for i := 0; i < n; i++ {
        tmp,_ = stin.ReadBytes(' ')
        x,_ := strconv.Atoi(string(bytes.Trim(tmp," ")))
        tmp,_ = stin.ReadBytes('\n')
        y,_ := strconv.Atoi(string(bytes.Trim(tmp,"\n\r")))
        //fmt.Printf("%v %v\n", x, y)
        d := math.Hypot(float64(px-x), float64(py-y))
        if d > maxDistance {
            maxDistance = d
        }
        if d < minDistance {
            minDistance = d
            minDistanceVertex = i
        }
        v[i] = vertex{x:float64(x), y:float64(y)}
    }
    //fmt.Printf("%v", v)

    i := minDistanceVertex
    j := minDistanceVertex - 1
    if j < 0 {
        j = n-1
    }
    hL := dist(float64(px), float64(py), &v[i], &v[j])
    if hL < minDistance {
        minDistance = hL
    }

    j = (minDistanceVertex + 1)%n
    hR := dist(float64(px), float64(py), &v[i], &v[j])
    if hR < minDistance {
        minDistance = hR
    }
    fmt.Printf("%.12f\n", (maxDistance*maxDistance - minDistance*minDistance) * math.Pi)
}

package main

import (
         "bufio"
         "os"
         "fmt"
         "strconv"
         "bytes"
         "math"
       )

type vertex struct {
    x float64
    y float64
}

type vertices []vertex

func dist(pfx, pfy float64, vi, vj *vertex) float64 {
    x1 := (*vi).x
    y1 := (*vi).y
    x2 := (*vj).x
    y2 := (*vj).y

    if x1 == x2 && y1 == y2 {
        return math.Hypot(x1, y1)
    }

    var h float64
    dd := (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)
    z := ((pfx - x1) * (x2 - x1) + (pfy - y1) * (y2 - y1)) / dd
    if z < 0.0 {
        h = math.Hypot(x1 - pfx, y1 - pfy)
    } else if z > 1.0 {
        h = math.Hypot(x2 - pfx, y2 - pfy)
    } else {
        hx := x1 + z * (x2 - x1)
        hy := y1 + z * (y2 - y1)
        h = math.Hypot(hx - pfx, hy - pfy)
    }
    return h
}

func main() {
    stin := bufio.NewReader(os.Stdin)
    var tmp []byte
    tmp,_ = stin.ReadBytes(' ')
    n,_ := strconv.Atoi(string(bytes.Trim(tmp," ")))
    tmp,_ = stin.ReadBytes(' ')
    px,_ := strconv.ParseFloat(string(bytes.Trim(tmp," ")), 64)
    tmp,_ = stin.ReadBytes('\n')
    py,_ := strconv.ParseFloat(string(bytes.Trim(tmp,"\n\r")), 64)
    //fmt.Printf("%v %v %v\n", n, px, py)

    var v vertices = make(vertices, n)
    minDistance := float64(1.0e18)
    var minDistanceVertex int = -1
    maxDistance := float64(0.0)
    for i := 0; i < n; i++ {
        tmp,_ = stin.ReadBytes(' ')
        x,_ := strconv.ParseFloat(string(bytes.Trim(tmp," ")), 64)
        tmp,_ = stin.ReadBytes('\n')
        y,_ := strconv.ParseFloat(string(bytes.Trim(tmp,"\n\r")), 64)
        //fmt.Printf("%v %v\n", x, y)
        d := math.Hypot(px-x, py-y)
        if d > maxDistance {
            maxDistance = d
        }
        if d < minDistance {
            minDistance = d
            minDistanceVertex = i
        }
        v[i] = vertex{x:x, y:y}
    }
    //fmt.Printf("%v", v)

    i := minDistanceVertex
    j := minDistanceVertex - 1
    if j < 0 {
        j = n-1
    }
    hL := dist(px, py, &v[i], &v[j])
    if hL < minDistance {
        minDistance = hL
    }

    j = (minDistanceVertex + 1)%n
    hR := dist(px, py, &v[i], &v[j])
    if hR < minDistance {
        minDistance = hR
    }
    fmt.Printf("%.12f\n", (maxDistance*maxDistance - minDistance*minDistance) * math.Pi)
}

package main

import (
         "bufio"
         "os"
         "fmt"
         "strconv"
         "bytes"
         "math"
       )

type vertex struct {
    x float64
    y float64
}

type vertices []vertex

func dist(pfx, pfy float64, vi, vj *vertex) float64 {
    x1 := (*vi).x
    y1 := (*vi).y
    x2 := (*vj).x
    y2 := (*vj).y

    if x1 == x2 && y1 == y2 {
        return math.Hypot(x1, y1)
    }

    var h float64
    dd := (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)
    z := ((pfx - x1) * (x2 - x1) + (pfy - y1) * (y2 - y1)) / dd
    if z < 0.0 {
        h = math.Hypot(x1 - pfx, y1 - pfy)
    } else if z > 1.0 {
        h = math.Hypot(x2 - pfx, y2 - pfy)
    } else {
        hx := x1 + z * (x2 - x1)
        hy := y1 + z * (y2 - y1)
        h = math.Hypot(hx - pfx, hy - pfy)
    }
    return h
}

func main() {
    stin := bufio.NewReader(os.Stdin)
    var tmp []byte
    tmp,_ = stin.ReadBytes(' ')
    n,_ := strconv.Atoi(string(bytes.Trim(tmp," ")))
    tmp,_ = stin.ReadBytes(' ')
    px,_ := strconv.Atoi(string(bytes.Trim(tmp," ")))
    tmp,_ = stin.ReadBytes('\n')
    py,_ := strconv.Atoi(string(bytes.Trim(tmp,"\n\r")))
    //fmt.Printf("%v %v %v\n", n, px, py)

    var v vertices = make(vertices, n)
    minDistance := float64(1.0e18)
    var minDistanceVertex int = -1
    maxDistance := float64(0.0)
    for i := 0; i < n; i++ {
        tmp,_ = stin.ReadBytes(' ')
        x,_ := strconv.Atoi(string(bytes.Trim(tmp," ")))
        tmp,_ = stin.ReadBytes('\n')
        y,_ := strconv.Atoi(string(bytes.Trim(tmp,"\n\r")))
        //fmt.Printf("%v %v\n", x, y)
        d := math.Hypot(float64(px-x), float64(py-y))
        if d > maxDistance {
            maxDistance = d
        }
        if d < minDistance {
            minDistance = d
            minDistanceVertex = i
        }
        v[i] = vertex{x:float64(x), y:float64(y)}
    }
    //fmt.Printf("%v", v)

    i := minDistanceVertex
    j := minDistanceVertex - 1
    if j < 0 {
        j = n-1
    }
    hL := dist(float64(px), float64(py), &v[i], &v[j])
    if hL < minDistance {
        minDistance = hL
    }

    j = (minDistanceVertex + 1)%n
    hR := dist(float64(px), float64(py), &v[i], &v[j])
    if hR < minDistance {
        minDistance = hR
    }
    fmt.Printf("%.12f\n", (maxDistance*maxDistance - minDistance*minDistance) * math.Pi)
}

package main

import (
         "bufio"
         "os"
         "fmt"
         "strconv"
         "bytes"
         "math"
       )

type vertex struct {
    x float64
    y float64
}

type vertices []vertex

func main() {
    stin := bufio.NewReader(os.Stdin)
    var tmp []byte
    tmp,_ = stin.ReadBytes(' ')
    n,_ := strconv.Atoi(string(bytes.Trim(tmp," ")))
    tmp,_ = stin.ReadBytes(' ')
    px,_ := strconv.Atoi(string(bytes.Trim(tmp," ")))
    tmp,_ = stin.ReadBytes('\n')
    py,_ := strconv.Atoi(string(bytes.Trim(tmp,"\n\r")))
    //fmt.Printf("%v %v %v\n", n, px, py)

    var v vertices = make(vertices, n)
    minDistance := float64(1.0e18)
    maxDistance := float64(0.0)
    for i := 0; i < n; i++ {
        tmp,_ = stin.ReadBytes(' ')
        x,_ := strconv.Atoi(string(bytes.Trim(tmp," ")))
        tmp,_ = stin.ReadBytes('\n')
        y,_ := strconv.Atoi(string(bytes.Trim(tmp,"\n\r")))
        //fmt.Printf("%v %v\n", x, y)
        d := math.Sqrt(float64((px-x)*(px-x) + (py-y)*(py-y)))
        if d > maxDistance {
            maxDistance = d
        }
        if d < minDistance {
            minDistance = d
        }
        v[i] = vertex{x:float64(x), y:float64(y)}
    }
    //fmt.Printf("%v", v)

    fmt.Printf("%v\n", math.Pi * (maxDistance*maxDistance - minDistance*minDistance))

}


The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence) equal to zero for some fixed k (k < n), and this should be done in the smallest possible number of moves.One move is choosing an integer i (1 ≤ i ≤ n) such that ai > 0 and an integer t (t ≥ 0) such that i + 2t ≤ n. After the values of i and t have been selected, the value of ai is decreased by 1, and the value of ai + 2t is increased by 1. For example, let n = 4 and a = (1, 0, 1, 2), then it is possible to make move i = 3, t = 0 and get a = (1, 0, 0, 3) or to make move i = 1, t = 1 and get a = (0, 0, 2, 2) (the only possible other move is i = 1, t = 0).You are given n and the initial sequence ai. The task is to calculate the minimum number of moves needed to make the first k elements of the original sequence equal to zero for each possible k (1 ≤ k < n).

The first input line contains a single integer n. The second line contains n integers ai (0 ≤ ai ≤ 104), separated by single spaces. The input limitations for getting 20 points are:    1 ≤ n ≤ 300  The input limitations for getting 50 points are:    1 ≤ n ≤ 2000  The input limitations for getting 100 points are:    1 ≤ n ≤ 105

Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams, or the %I64d specifier.

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

func main() {
	n := ScanInt()
	a := ScanIntSlice(n)
	move := int64(0)
	for i := 0; i < n-1; i++ {
		t := get2(i, n)
		move += int64(a[i])
		a[i+t] += a[i]
		P(move)
	}

	close(O)
	oWg.Wait()
}

func get2(k, n int) int {
	x := 1
	for (x<<1 + k + 1) <= n {
		x <<= 1
	}
	return x
}

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

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var P func(a ...interface{}) (n int, err error)

func init() {
	P = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}()
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanInt() int     { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInt64() int64 { i, _ := strconv.ParseInt(ScanWord(), 10, 64); return i }
func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt()
	}
	return arr
}
func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func S(v interface{}) string { return fmt.Sprintf("%v", v) }
func SArr(a []int) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.Itoa(a[i]) + " ")
	}
	return sb.String()
}
func SArr64(a []int64) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.FormatInt(a[i], 10) + " ")
	}
	return sb.String()
}
func MnMx(args ...int64) (int64, int64) {
	minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64)
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}
func Mn(args ...int64) int64 { mn, _ := MnMx(args...); return mn }
func Mx(args ...int64) int64 { _, mx := MnMx(args...); return mx }
func LCM(a, b int64) int64   { return a / GCD(a, b) * b }
func GCD(a, b int64) int64 {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func sortInt64Slice(a []int64) { sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

func main() {
	n := ScanInt()
	givenArray := ScanInt64Slice(n)
	t := 0
	moves := int64(0)

	for i := 0; i < n - 1; i++ {
		for float64(i)+math.Pow(2, float64(t)) < float64(n) {
			t++
		}
		t -= 1
		moves += givenArray[i]
		givenArray[int(float64(i)+ math.Pow(2, float64(t)))] += givenArray[i]
		P(moves)
	}

	close(O)
	oWg.Wait()
}

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

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var P func(a ...interface{}) (n int, err error)

func init() {
	P = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}()
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanInt() int     { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInt64() int64 { i, _ := strconv.ParseInt(ScanWord(), 10, 64); return i }
func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt()
	}
	return arr
}
func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func S(v interface{}) string { return fmt.Sprintf("%v", v) }
func SArr(a []int) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.Itoa(a[i]) + " ")
	}
	return sb.String()
}
func SArr64(a []int64) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.FormatInt(a[i], 10) + " ")
	}
	return sb.String()
}
func MnMx(args ...int64) (int64, int64) {
	minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64)
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}
func Mn(args ...int64) int64 { mn, _ := MnMx(args...); return mn }
func Mx(args ...int64) int64 { _, mx := MnMx(args...); return mx }
func LCM(a, b int64) int64   { return a / GCD(a, b) * b }
func GCD(a, b int64) int64 {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func sortInt64Slice(a []int64) { sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

func main() {
	n := ScanInt()
	a := ScanIntSlice(n)
	ka := make([]int, n)
	ka[0] = a[0]
	t := get2(0, n)
	a[t] += a[0]

	for k := 1; k < n-1; k++ {
		ka[k] += ka[k-1] + a[k]
		t := get2(k, n)
		a[t] += a[k]
		a[k] = 0
	}

	for i := 0; i < len(ka); i++ {
		P(ka[i])
	}
	close(O)
	oWg.Wait()
}

func get2(k, n int) int {
	x := 1
	for (x + k) <= n {
		if (x<<1 + k) < n {
			x <<= 1
		} else {
			break
		}
	}
	return x
}

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

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var P func(a ...interface{}) (n int, err error)

func init() {
	P = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}()
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanInt() int     { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInt64() int64 { i, _ := strconv.ParseInt(ScanWord(), 10, 64); return i }
func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt()
	}
	return arr
}
func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func S(v interface{}) string { return fmt.Sprintf("%v", v) }
func SArr(a []int) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.Itoa(a[i]) + " ")
	}
	return sb.String()
}
func SArr64(a []int64) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.FormatInt(a[i], 10) + " ")
	}
	return sb.String()
}
func MnMx(args ...int64) (int64, int64) {
	minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64)
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}
func Mn(args ...int64) int64 { mn, _ := MnMx(args...); return mn }
func Mx(args ...int64) int64 { _, mx := MnMx(args...); return mx }
func LCM(a, b int64) int64   { return a / GCD(a, b) * b }
func GCD(a, b int64) int64 {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func sortInt64Slice(a []int64) { sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

func main() {
	n := ScanInt()
	givenArray := ScanIntSlice(n)
	t := 0
	moves := 0

	for i := 0; i < n-1; i++ {
		for float64(i)+math.Pow(2, float64(t)) < float64(n) {
			t++
		}
		t--
		moves += givenArray[i]
		givenArray[int(float64(i)+ math.Pow(2, float64(t)))] = givenArray[int(float64(i)+ math.Pow(2, float64(t)))] + givenArray[i]
		P(abs(int64(moves)))
	}

	close(O)
	oWg.Wait()
}

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

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var P func(a ...interface{}) (n int, err error)

func init() {
	P = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}()
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanInt() int     { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInt64() int64 { i, _ := strconv.ParseInt(ScanWord(), 10, 64); return i }
func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt()
	}
	return arr
}
func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func S(v interface{}) string { return fmt.Sprintf("%v", v) }
func SArr(a []int) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.Itoa(a[i]) + " ")
	}
	return sb.String()
}
func SArr64(a []int64) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.FormatInt(a[i], 10) + " ")
	}
	return sb.String()
}
func MnMx(args ...int64) (int64, int64) {
	minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64)
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}
func Mn(args ...int64) int64 { mn, _ := MnMx(args...); return mn }
func Mx(args ...int64) int64 { _, mx := MnMx(args...); return mx }
func LCM(a, b int64) int64   { return a / GCD(a, b) * b }
func GCD(a, b int64) int64 {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func sortInt64Slice(a []int64) { sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

func main() {
	n := ScanInt()
	givenArray := ScanIntSlice(n)
	t := 0
	moves := 0

	for i := 0; i < n-1; i++ {
		for float64(i)+math.Pow(2, float64(t)) < float64(n) {
			t++
		}
		t--
		moves += givenArray[i]
		givenArray[int(float64(i)+ math.Pow(2, float64(t)))] = givenArray[int(float64(i)+ math.Pow(2, float64(t)))] + givenArray[i]
		P(moves)
	}

	close(O)
	oWg.Wait()
}

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

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var P func(a ...interface{}) (n int, err error)

func init() {
	P = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}()
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanInt() int     { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInt64() int64 { i, _ := strconv.ParseInt(ScanWord(), 10, 64); return i }
func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt()
	}
	return arr
}
func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func S(v interface{}) string { return fmt.Sprintf("%v", v) }
func SArr(a []int) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.Itoa(a[i]) + " ")
	}
	return sb.String()
}
func SArr64(a []int64) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.FormatInt(a[i], 10) + " ")
	}
	return sb.String()
}
func MnMx(args ...int64) (int64, int64) {
	minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64)
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}
func Mn(args ...int64) int64 { mn, _ := MnMx(args...); return mn }
func Mx(args ...int64) int64 { _, mx := MnMx(args...); return mx }
func LCM(a, b int64) int64   { return a / GCD(a, b) * b }
func GCD(a, b int64) int64 {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func sortInt64Slice(a []int64) { sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

func main() {
	n := ScanInt()
	n--
	givenArray := ScanIntSlice(n)
	t := 0
	moves := 0

	for i := 0; i < n; i++ {
		for float64(i)+math.Pow(2, float64(t)) < float64(n) {
			t++
		}
		t--
		moves += givenArray[i]
		givenArray[int(float64(i)+ math.Pow(2, float64(t)))] += givenArray[i]
		P(moves)
	}

	close(O)
	oWg.Wait()
}

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

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var P func(a ...interface{}) (n int, err error)

func init() {
	P = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}()
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanInt() int     { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInt64() int64 { i, _ := strconv.ParseInt(ScanWord(), 10, 64); return i }
func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt()
	}
	return arr
}
func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func S(v interface{}) string { return fmt.Sprintf("%v", v) }
func SArr(a []int) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.Itoa(a[i]) + " ")
	}
	return sb.String()
}
func SArr64(a []int64) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.FormatInt(a[i], 10) + " ")
	}
	return sb.String()
}
func MnMx(args ...int64) (int64, int64) {
	minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64)
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}
func Mn(args ...int64) int64 { mn, _ := MnMx(args...); return mn }
func Mx(args ...int64) int64 { _, mx := MnMx(args...); return mx }
func LCM(a, b int64) int64   { return a / GCD(a, b) * b }
func GCD(a, b int64) int64 {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func sortInt64Slice(a []int64) { sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

func main() {
	n := ScanInt()
	givenArray := ScanIntSlice(n)
	t := 0
	moves := 0

	for i := 0; i < n; i++ {
		if i == n - 1{
			break
		}
		for float64(i)+math.Pow(2, float64(t)) < float64(n) {
			t++
		}
		t -= 1
		moves += givenArray[i]
		givenArray[int(float64(i)+ math.Pow(2, float64(t)))] += givenArray[i]
		P(moves)
	}

	close(O)
	oWg.Wait()
}

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

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var P func(a ...interface{}) (n int, err error)

func init() {
	P = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}()
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanInt() int     { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInt64() int64 { i, _ := strconv.ParseInt(ScanWord(), 10, 64); return i }
func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt()
	}
	return arr
}
func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func S(v interface{}) string { return fmt.Sprintf("%v", v) }
func SArr(a []int) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.Itoa(a[i]) + " ")
	}
	return sb.String()
}
func SArr64(a []int64) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.FormatInt(a[i], 10) + " ")
	}
	return sb.String()
}
func MnMx(args ...int64) (int64, int64) {
	minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64)
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}
func Mn(args ...int64) int64 { mn, _ := MnMx(args...); return mn }
func Mx(args ...int64) int64 { _, mx := MnMx(args...); return mx }
func LCM(a, b int64) int64   { return a / GCD(a, b) * b }
func GCD(a, b int64) int64 {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func sortInt64Slice(a []int64) { sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

func main() {
	n := ScanInt()
	givenArray := ScanIntSlice(n)
	t := 0
	moves := 0

	for i := 0; i < n-1; i++ {
		for float64(i)+math.Pow(2, float64(t)) < float64(n) {
			t++
		}
		t -= 1
		moves += givenArray[i]
		givenArray[int(float64(i)+ math.Pow(2, float64(t)))] += givenArray[i]
		P(moves)
	}

	close(O)
	oWg.Wait()
}

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

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var P func(a ...interface{}) (n int, err error)

func init() {
	P = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}()
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanInt() int     { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInt64() int64 { i, _ := strconv.ParseInt(ScanWord(), 10, 64); return i }
func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt()
	}
	return arr
}
func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func S(v interface{}) string { return fmt.Sprintf("%v", v) }
func SArr(a []int) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.Itoa(a[i]) + " ")
	}
	return sb.String()
}
func SArr64(a []int64) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.FormatInt(a[i], 10) + " ")
	}
	return sb.String()
}
func MnMx(args ...int64) (int64, int64) {
	minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64)
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}
func Mn(args ...int64) int64 { mn, _ := MnMx(args...); return mn }
func Mx(args ...int64) int64 { _, mx := MnMx(args...); return mx }
func LCM(a, b int64) int64   { return a / GCD(a, b) * b }
func GCD(a, b int64) int64 {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func sortInt64Slice(a []int64) { sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}


Vasya has recently got a job as a cashier at a local store. His day at work is $$$L$$$ minutes long. Vasya has already memorized $$$n$$$ regular customers, the $$$i$$$-th of which comes after $$$t_{i}$$$ minutes after the beginning of the day, and his service consumes $$$l_{i}$$$ minutes. It is guaranteed that no customer will arrive while Vasya is servicing another customer. Vasya is a bit lazy, so he likes taking smoke breaks for $$$a$$$ minutes each. Those breaks may go one after another, but Vasya must be present at work during all the time periods he must serve regular customers, otherwise one of them may alert his boss. What is the maximum number of breaks Vasya can take during the day?

Output one integer  — the maximum number of breaks.

NoteIn the first sample Vasya can take $$$3$$$ breaks starting after $$$2$$$, $$$5$$$ and $$$8$$$ minutes after the beginning of the day.In the second sample Vasya can take $$$2$$$ breaks starting after $$$0$$$ and $$$2$$$ minutes after the beginning of the day.In the third sample Vasya can't take any breaks.

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)

func main() {
    var n, l , a int
    fmt.Fscanln(reader, &n, &l, &a)
    var prev11, prev12, prev21, prev22, nbreaks int
    for i := 0; i < n; i++ {
        fmt.Fscanln(reader, &prev21, &prev22)
	ttrest := prev21 - (prev11 + prev12)
	nbreaks += ttrest / a
	prev11 = prev21
	prev12 = prev22
    }
    ttrest := l - (prev11 + prev12)
    nbreaks += ttrest / a
    fmt.Println(nbreaks)
}

package main

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

func main() {
	var n, l, a int
	var t [100000 + 5]int
	var s [100000 + 5]int
	buf := bufio.NewReader(os.Stdin)
	fmt.Fscanf(buf, "%d %d %d\n", &n, &l, &a)
	for i := 0; i < n; i++ {
		fmt.Fscanf(buf, "%d %d\n", &t[i], &s[i])
	}
	now := 0
	ans := 0
	for i := 0; i < n; i++ {
		ans += ((t[i] - now) / a)
		now = t[i] + s[i]
	}
	ans += ((l - now) / a)
	fmt.Println(ans)
}

package main

import (
	"bufio"
	"math"
	"os"
	"strconv"
	"sync"
)

const (
	MAX_INT int64 = math.MaxInt64
	MIN_INT int64 = math.MinInt64
)

//3 13 3
//0 5
//7 2
//9 2

func main() {
	ans := int64(0)
	n, L, a := ScanInt64(), ScanInt64(), ScanInt64()

	currTime := int64(0)
	for i := int64(0); i < n; i++ {
		ti, li := ScanInt64(), ScanInt64()

		//if ti-currTime > a {
		ans += ((ti - currTime) / a)
		//}
		currTime = ti + li
	}

	ans += (L - currTime) / a

	out <- iToS(ans)

	close(out)
	outWg.Wait()
}

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

var out chan string
var in *bufio.Scanner
var outWg *sync.WaitGroup

func init() {
	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(2e+5))
	in.Split(bufio.ScanWords)

	out = make(chan string, 16)
	outWg = &sync.WaitGroup{}
	outWg.Add(1)

	writer := bufio.NewWriterSize(os.Stdout, int(2e+5))
	go func(writer *bufio.Writer) {
		defer outWg.Done()
		defer writer.Flush()

		for line := range out {
			writer.WriteString(line + "\n")
		}
	}(writer)
}

func ScanWord() string {
	in.Scan()
	return in.Text()
}

func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}

func ScanInt64() int64 {
	intStr := ScanWord()
	i, err := strconv.ParseInt(intStr, 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func Max(args ...int64) int64 {
	maxVal := MIN_INT
	for _, v := range args {
		if v > maxVal {
			maxVal = v
		}
	}
	return maxVal
}

func Min(args ...int64) int64 {
	minVal := MAX_INT
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
	}
	return minVal
}

func LCM(a, b int64) int64 {
	return a / GCD(a, b) * b
}

func GCD(a, b int64) int64 {
	if (a == 0) {
		return b
	}
	return GCD(b%a, a)
}

func iToS(v int64) string {
	return strconv.FormatInt(v, 10)
}

package main

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

func main() {

	buf := bufio.NewReader(os.Stdin)
	var n, endT, termT int
	fmt.Fscanf(buf, "%d %d %d\n", &n, &endT, &termT)

	var freeStart, freeEnd int // [freeStart, freeEnd)

	termCnt := 0
	for i := 0; i < n; i++ {
		var t, l int
		fmt.Fscanf(buf, "%d %d\n", &t, &l)
		freeEnd = t

		termCnt += ((freeEnd - freeStart) / termT)

		freeStart = t + l
	}
	termCnt += ((endT - freeStart) / termT)

	fmt.Println(termCnt)
}

package main

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

func main() {
	n, l, a, e, scanner := 0, 0, 0, 0, bufio.NewScanner(os.Stdin)
	fmt.Scan(&n, &l, &a)
	q := make([][2]int, n)
	scanner.Split(bufio.ScanWords)
	for i := 0; i < n; i++ {
		scanner.Scan()
		q[i][0], _ = strconv.Atoi(scanner.Text())
		scanner.Scan()
		q[i][1], _ = strconv.Atoi(scanner.Text())
	}

	total := 0
	for i := 0; i < n; i++ {
		total += (q[i][0] - e) / a
		e = q[i][0] + q[i][1]
	}
	total += (l - e) / a

	fmt.Println(total)
}

package main

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

func main() {
	n, l, a, e, scanner := 0, 0, 0, 0, bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	fmt.Scan(&n, &l, &a)
	q := make([][2]int, n)
	for i := 0; i < n; i++ {
		scanner.Scan()
		q[i][0], _ = strconv.Atoi(scanner.Text())
		scanner.Scan()
		q[i][1], _ = strconv.Atoi(scanner.Text())
	}

	total := 0
	for i := 0; i < n; i++ {
		total += (q[i][0] - e) / a
		e = q[i][0] + q[i][1]
	}
	total += (l - e) / a

	fmt.Println(total)
}

package main

import (
	"bufio"
	"os"
	"fmt"
)
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...) }
func println(a ...interface{}) { fmt.Fprintln(writer, a...) }
func scanln(a ...interface{}) { fmt.Fscanln(reader, a...) }

func main() {
	defer writer.Flush()
	var n,d,a int
	scanln(&n,&d,&a)
	var s []int
	r := 0
	for i:=0;i<n;i++ {
		var t,l int
		scanln(&t,&l)
		s = append(s, t - r)
		r = t + l
	}
	s = append(s,d - r)
	k := 0
	for _,i := range(s){
		k += i/a
	}

	fmt.Println(k)
}

package main

import (
	"bufio"
	"math"
	"os"
	"strconv"
	"sync"
)

const (
	MAX_INT int64 = math.MaxInt64
	MIN_INT int64 = math.MinInt64
)

//3 11 1
//0 5
//5 8
//8 11

func main() {
	ans := int64(0)
	n, L, a := ScanInt64(), ScanInt64(), ScanInt64()
	customerServiceTime := int64(0)

	for i := int64(0); i < n; i++ {
		ti, li := ScanInt64(), ScanInt64()
		if ti == int64(0) {

		}
		customerServiceTime += li
	}

	ans = Max((L - customerServiceTime) / a, 0)

	out <- iToS(ans)

	close(out)
	outWg.Wait()
}

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

var out chan string
var in *bufio.Scanner
var outWg *sync.WaitGroup

func init() {
	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(2e+5))
	in.Split(bufio.ScanWords)

	out = make(chan string, 16)
	outWg = &sync.WaitGroup{}
	outWg.Add(1)

	writer := bufio.NewWriterSize(os.Stdout, int(2e+5))
	go func(writer *bufio.Writer) {
		defer outWg.Done()
		defer writer.Flush()

		for line := range out {
			writer.WriteString(line + "\n")
		}
	}(writer)
}

func ScanWord() string {
	in.Scan()
	return in.Text()
}

func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}

func ScanInt64() int64 {
	intStr := ScanWord()
	i, err := strconv.ParseInt(intStr, 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func Max(args ...int64) int64 {
	maxVal := MIN_INT
	for _, v := range args {
		if v > maxVal {
			maxVal = v
		}
	}
	return maxVal
}

func Min(args ...int64) int64 {
	minVal := MAX_INT
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
	}
	return minVal
}

func LCM(a, b int64) int64 {
	return a / GCD(a, b) * b
}

func GCD(a, b int64) int64 {
	if (a == 0) {
		return b
	}
	return GCD(b%a, a)
}

func iToS(v int64) string {
	return strconv.FormatInt(v, 10)
}

package main

import (
	"bufio"
	"math"
	"os"
	"strconv"
	"sync"
)

const (
	MAX_INT int64 = math.MaxInt64
	MIN_INT int64 = math.MinInt64
)

func main() {
	ans := int64(0)
	n, L, a := ScanInt64(), ScanInt64(), ScanInt64()
	customerServiceTime := int64(0)

	for i := int64(0); i < n; i++ {
		ti, li := ScanInt64(), ScanInt64()
		if ti == int64(0) {

		}
		customerServiceTime += li
	}

	ans = (L - customerServiceTime) / a

	out <- iToS(ans)

	close(out)
	outWg.Wait()
}

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

var out chan string
var in *bufio.Scanner
var outWg *sync.WaitGroup

func init() {
	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(2e+5))
	in.Split(bufio.ScanWords)

	out = make(chan string, 16)
	outWg = &sync.WaitGroup{}
	outWg.Add(1)

	writer := bufio.NewWriterSize(os.Stdout, int(2e+5))
	go func(writer *bufio.Writer) {
		defer outWg.Done()
		defer writer.Flush()

		for line := range out {
			writer.WriteString(line + "\n")
		}
	}(writer)
}

func ScanWord() string {
	in.Scan()
	return in.Text()
}

func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}

func ScanInt64() int64 {
	intStr := ScanWord()
	i, err := strconv.ParseInt(intStr, 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func Max(args ...int64) int64 {
	maxVal := MIN_INT
	for _, v := range args {
		if v > maxVal {
			maxVal = v
		}
	}
	return maxVal
}

func Min(args ...int64) int64 {
	minVal := MAX_INT
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
	}
	return minVal
}

func LCM(a, b int64) int64 {
	return a / GCD(a, b) * b
}

func GCD(a, b int64) int64 {
	if (a == 0) {
		return b
	}
	return GCD(b%a, a)
}

func iToS(v int64) string {
	return strconv.FormatInt(v, 10)
}

package main

import "fmt"

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

	var freeStart, freeEnd int // [freeStart, freeEnd)
	if 1 <= n {
		fmt.Scanf("%d%d ", &freeStart, &freeEnd)
		freeStart += freeEnd
	}

	termCnt := 0
	for i := 1; i < n; i++ {
		var t, l int
		fmt.Scanf("%d%d ", &t, &l)
		freeEnd = t

		termCnt += (freeEnd - freeStart) / termT

		freeStart = t + l
	}
	termCnt += (endT - freeStart) / termT

	fmt.Println(termCnt)
}

package main

import "fmt"

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

	var freeStart, freeEnd int // [freeStart, freeEnd)
	if 1 <= n {
		fmt.Scanf("%d %d\n", &freeStart, &freeEnd)
		freeStart += freeEnd
	}

	termCnt := 0
	for i := 1; i < n; i++ {
		var t, l int
		fmt.Scanf("%d %d\n", &t, &l)
		freeEnd = t

		termCnt += (freeEnd - freeStart) / termT

		freeStart = t + l
	}
	termCnt += (endT - freeStart) / termT

	fmt.Println(termCnt)
}

package main

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

func main() {

	buf := bufio.NewReader(os.Stdin)
	var n, endT, termT int
	fmt.Fscanf(buf, "%d %d %d\n", &n, &endT, &termT)

	var freeStart, freeEnd int // [freeStart, freeEnd)
	if 1 <= n {
		fmt.Fscanf(buf, "%d %d\n", &freeStart, &freeEnd)
		freeStart += freeEnd
	}

	termCnt := 0
	for i := 1; i < n; i++ {
		var t, l int
		fmt.Fscanf(buf, "%d %d\n", &t, &l)
		freeEnd = t

		termCnt += ((freeEnd - freeStart) / termT)

		freeStart = t + l
	}
	termCnt += ((endT - freeStart) / termT)

	fmt.Println(termCnt)
}

package main

import "fmt"

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

	var freeStart, freeEnd int // [freeStart, freeEnd)
	if 1 <= n {
		fmt.Scanf("%d%d", &freeStart, &freeEnd)
		freeStart += freeEnd
	}

	termCnt := 0
	for i := 1; i < n; i++ {
		var t, l int
		fmt.Scanf("%d%d", &t, &l)
		freeEnd = t

		termCnt += (freeEnd - freeStart) / termT

		freeStart = t + l
	}
	termCnt += (endT - freeStart) / termT

	fmt.Println(termCnt)
}

package main

import "fmt"

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

	var freeStart, freeEnd int // [freeStart, freeEnd)
	if 1 <= n {
		fmt.Scanf("%d %d\n", &freeStart, &freeEnd)
		freeStart += freeEnd
	}

	termCnt := 0
	for i := 1; i < n; i++ {
		var t, l int
		fmt.Scanf("%d %d\n", &t, &l)
		freeEnd = t

		termCnt += ((freeEnd - freeStart) / termT)

		freeStart = t + l
	}
	termCnt += ((endT - freeStart) / termT)

	fmt.Println(termCnt)
}

package main

import "fmt"

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

	var freeStart, freeEnd int // [freeStart, freeEnd)
	if 1 <= n {
		fmt.Scanf("%d %d ", &freeStart, &freeEnd)
		freeStart += freeEnd
	}

	termCnt := 0
	for i := 1; i < n; i++ {
		var t, l int
		fmt.Scanf("%d %d ", &t, &l)
		freeEnd = t

		termCnt += (freeEnd - freeStart) / termT

		freeStart = t + l
	}
	termCnt += (endT - freeStart) / termT

	fmt.Println(termCnt)
}