### Source: Duet

Part 1:Create a virtual machine with the following instruction set:

`snd X`

plays a sound with a frequency equal to the value of`X`

`set X Y`

sets register`X`

to`Y`

`add X Y`

set register`X`

to`X + Y`

`mul X Y`

sets register`X`

to`X * Y`

`mod X Y`

sets register`X`

to`X mod Y`

`rcv X`

recovers the frequency of the last sound played, if`X`

is not zero`jgz X Y`

jumps with an offset of the value of`Y`

, iff`X`

is greater than zero

In most cases,

`X`

and`Y`

can be either an integer value or a register.

What is the value recovered by

`rcv`

the first time`X`

is non-zero?