2586: 同余方程(Day 2)
          Memory Limit:128 MB
          Time Limit:1.000 S
         
      
      
        
          Judge Style:Text Compare
          Creator:
      
      
          Submit:2
          Solved:5
      
Description
求关于x的同余方程ax≡1(mod b)的最小正整数解。
	
Input
每组输入数据只有一行,包含两个正整数a, b,用一个空格隔开。
	
数据规模:
对于40%的数据,2≤b≤1,000;
对于60%的数据,2≤b≤50,000,000;
对于100%的数据,2≤a, b≤2,000,000,000。
	
Output
每组输出只有一行,包含一个正整数x0,即最小正整数解。输入数据保证一定有解。
	
Sample Input Copy
3 10Sample Output Copy
7