CF919E Congruence Equation

Description

Given an integer $ x $ . Your task is to find out how many positive integers $ n $ ( $ 1

Input Format

The only line contains four integers $ a,b,p,x $ ( $ 2

Output Format

Print a single integer: the number of possible answers $ n $ .

Explanation/Hint

In the first sample, we can see that $ n=2 $ and $ n=8 $ are possible answers.