This page is still under construction.

Parts of this page are still being built. What you see may change.

Wave Attack

Time limit2sMemory limit512 MB

Summary
Count how many reflected shockwave paths from the launcher reach the Count within t seconds, where simultaneous arrivals from different directions each count.
Level

Medium6 of 10

Topics
Geometry, Math, Number theory, Implementation
Solved
No attempts yet

Problem

The valiant Ikta has finally cornered the notorious Count Bigbridge! The Count is now trapped in a rectangular room ww meters wide and hh meters deep, waiting for his end.

Choose one corner of the room, take the width direction as the xx-axis and the depth direction as the yy-axis, each oriented so that the interior of the room lies in the positive direction. The Count is at the point (p,q)(p, q). At the point (x,y)(x, y) there is a shockwave launcher, Ikta's ultimate weapon, which fires a shockwave of vv meters per second in all directions. The shockwave remains active for tt seconds and reflects off the walls of the room.

Ikta, standing outside the room, wants to know how much the Count suffers, so write a program that finds how many times the shockwave hits the Count. When the shockwave hits the enemy from nn directions at the same time, count it as nn hits, and a shockwave that hits the enemy exactly tt seconds later is also valid. The shockwave is not extinguished by obstacles such as the launcher itself or the Count, and shockwaves do not interfere with each other.

Input

The input is given in the following format.

ww hh vv tt xx yy pp qq

  • Each is a positive integer as described in the problem statement.

Output

Print the number of times the shockwave hits Count Bigbridge on one line.

Constraints

  • v×t≤106v \times t \le 10^6

  • 2≤w,h≤1082 \le w, h \le 10^8

  • 0<x,p<w0 < x, p < w

  • 0<y,q<h0 < y, q < h

  • (x,y)≠(p,q)(x, y) \ne (p, q)

Examples3

  1. Example 1

    Input
    10 10 1 10 3 3 7 7
    
    Expected output
    1
    
  2. Example 2

    Input
    10 10 1 11 3 3 7 7
    
    Expected output
    5
    
  3. Example 3

    Input
    2 3 1000 1000 1 1 1 2
    
    Expected output
    523598775681