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

#GL0000281. Ebony và Ivory (Ebony and Ivory)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Ebony và Ivory (Ebony and Ivory)

Ebony and Ivory

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Dante has weapons Ebony and Ivory. Every Ebony shot deals exactly aa damage; every Ivory shot deals bb. To break the shield, exactly cc damage is needed. Either weapon may be fired a nonnegative number of times. Decide whether nonnegative integers x,yx,y exist such that ax+by=cax+by=c.

Input

One line contains integers a,b,ca,b,c: damage per Ebony shot, per Ivory shot, and target damage.

Output

Print exactly Yes if possible; otherwise print No.

Subtasks

  • Subtask 1 (20 points): 1≤a,b≤1001\le a,b\le100; 1≤c≤1001\le c\le 100.
  • Subtask 2 (30 points): 1≤a,b≤1001\le a,b\le100; 1≤c≤10001\le c\le 1000.
  • Subtask 3 (50 points): 1≤a,b≤1001\le a,b\le100; 1≤c≤100001\le c\le 10000.

Examples

Example 1

Input

4 6 15

Output

No

Explanation

We need 4x+6y=15, with nonnegative integers x,y. Testing all feasible x values leaves no nonnegative integral y.

Example 2

Input

3 2 7

Output

Yes

Explanation

We need 3x+2y=7, with nonnegative integers x,y. Choosing x=1 and y=2 reaches exactly 7 damage.

Example 3

Input

6 11 6

Output

Yes

Explanation

We need 6x+11y=6, with nonnegative integers x,y. Choosing x=1 and y=0 reaches exactly 6 damage.