Uint47 calculator

TimeLimit:1000MS  MemoryLimit:524MB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description

In the distant space, there is a technologically advanced planet.

One day they provided the Earth with a code that could achieve the ultimate meaning of the universe. People were very happy, but found that this code can only run on computers with a word length of 47 bits. As a good computer scientist, you need to implement a tool to simulate running this code on our computer.

This tool needs to simulate the following instructions:

"def x n" : define a unsigned 47 bits integer variable named x, with initial value n, n is an integer in [0, 2^47-1]

"add x y" : means x = x + y

"sub x y" : means x = x - y

"mul x y" : means x = x * y

"div x y" : means x = x / y, we guarantee y is not zero

"mod x y" : means x = x % y, we guarantee y is not zero

When the result of addition and multiplication cannot be represented by 47 bits, the part above 47 bits is truncated.

When the result of subtraction is less than zero, the result should add 2^47.

The name of each variable only contains letters and the length does not greater than 20.

Input

Contains multiple lines of input, one instruction per line.

Output

For each instruction, output the value of the first argument after calculation. For example, "def abc 100", then your output will be "abc = 100" in a line with no quotation marks.

See Sample Output for more information.

SampleInput
def six 6
def abc 1
def bcd 0
sub bcd abc
add abc six
def universe 0
mul abc six
add universe abc
div bcd six
mod bcd abc
SampleOutput
six = 6
abc = 1
bcd = 0
bcd = 140737488355327
abc = 7
universe = 0
abc = 42
universe = 42
bcd = 23456248059221
bcd = 5
Submit
题目统计信息详细
总AC数29
通过人数22
尝试人数27
总提交量119
AC率18.49%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: