PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000060. Trò chơi Euclid (Euclid’s Game)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Trò chơi Euclid (Euclid’s Game)

Euclid's Game

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

Stan and Ollie take turns playing with two positive integers, with Stan moving first. On a turn, a player subtracts a positive integer multiple of one value from the other value, keeping the result nonnegative. Equal values are allowed: a player can then subtract one value from the other to obtain zero. Whoever makes a value zero wins immediately. Both players play optimally. Print the winner.

Input

Two positive integers a and b.

Output

Exactly Stan wins or Ollie wins.

Subtasks

  • Subtask 1 (20 points): 1≤a,b≤301\le a,b\le 30.
  • Subtask 2 (30 points): 1≤a,b≤1061\le a,b\le 10^6.
  • Subtask 3 (50 points): 1≤a,b≤231−11\le a,b\le 2^{31}-1.

Examples

Input

34 12

Output

Stan wins

Explanation

Stan subtracts 2⋅122\cdot12 from 3434, leaving (10,12)(10,12). Ollie has only one legal move: subtract 1010 from 1212, leaving (10,2)(10,2). Stan then subtracts 5⋅25\cdot2 from 1010 to create 00 and win, so the output is Stan wins.