시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB55333159.615%

문제

A UFO crash lands on Earth. The alien captain survives the crash relatively unscathed; however his trusty watch is damaged beyond repair.

The alien watch is very similar to a human watch: It is a disc 30mm in diameter and it has three hands of lengths A, B and C microns (1000 ≤ A, B, C ≤ 15000). However, the aliens measure time differently: there are N (2 ≤ N < 2 32) alien seconds to an alien minute. As such, there are N markings on the edge of the disc, rather than 60.

The watch’s glass cover is broken and the hands have come loose: they can rotate freely and independently of one another. By pointing each of the hands at an arbitrary marking, their tips can be made to form an imaginary triangle (as long as they are non-collinear).

Having nothing left to do but wait for help to arrive, the alien ponders the following question: What is the number M of distinct triangles that contain the watch’s center? (Triangles where the center lies on one of the edges of the triangle count as well.)

입력

The input consists of A, B, C, and N on a single line, separated by whitespace.

출력

The output is M modulo 264.

예제 입력 1

15000 15000 15000 2

예제 출력 1

0

예제 입력 2

5000 10000 15000 3

예제 출력 2

6

예제 입력 3

15000 15000 15000 3

예제 출력 3

1

예제 입력 4

15000 15000 15000 4

예제 출력 4

4

예제 입력 5

15000 15000 15000 5

예제 출력 5

5

예제 입력 6

15000 15000 15000 6

예제 출력 6

14