189B.md (1412B)
1 Source: https://codeforces.com/problemset/problem/189/B 2 3 B. Counting Rhombi 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 You have two positive integers *w* and *h*. Your task is to count the number of rhombi which have the following properties: 22 23 * Have positive area. 24 * With vertices at integer points. 25 * All vertices of the rhombi are located inside or on the border of the rectangle with vertices at points (0, 0), (*w*, 0), (*w*, *h*), (0, *h*). In other words, for all vertices (*x**i*, *y**i*) of the rhombus the following conditions should fulfill: 0 ≤ *x**i* ≤ *w* and 0 ≤ *y**i* ≤ *h*. 26 * Its diagonals are parallel to the axis. 27 28 Count the number of such rhombi. 29 30 Let us remind you that a rhombus is a quadrilateral whose four sides all have the same length. 31 32 Input 33 34 The first line contains two integers *w* and *h* (1 ≤ *w*, *h* ≤ 4000) — the rectangle's sizes. 35 36 Output 37 38 Print a single number — the number of sought rhombi. 39 40 Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. 41 42 Examples 43 44 Input 45 46 ``` 47 2 2 48 ``` 49 50 Output 51 52 ``` 53 1 54 ``` 55 56 Input 57 58 ``` 59 1 2 60 ``` 61 62 Output 63 64 ``` 65 0 66 ``` 67 68 Note 69 70 In the first example there exists only one such rhombus. Its vertices are located at points (1, 0), (2, 1), (1, 2), (0, 1).