logo AlgoBeat OnlineJudge
登录 注册

#206198. [NWRRC 2016] Java2016

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

John likes to learn esoteric programming languages. Recently he discovered the probabilistic Java2K. Built-in functions of Java2K have only a certain probability to do whatever you to do.

The Java2K programming is very hard, so John designed a much simpler language for training: Java2016. operators of Java2016 are deterministic, while their operands are random. Each value in a positive integer in the range , inclusive.

Java2016 supports six operators of three precedencies:

Minimum operators are defined as usual. Addition multiplication is rounded towards zero. the divider is zero, the program crashes. The argument of the operator is a result of another distributed random value , or macro substitution.

For instance, the probability that is evaluated to zero is , while the probability of is .

The Java2016 program consists of zero or more macro definitions, followed by the resulting expression. macro definition has a form of

The macro should be defined before the first use. It may not be redefined. The macro is expanded to on each use. For instance,

a = ? max ?
(a max $a) / a

is expanded to ((? max ?) max (? max ?)) / (? max ?).

John is going to add probabilistic constants to Java2016, so for each possible constant value he needs that successfully evaluates to this value with at least one-half probability. Crashes are failures.

输入格式

The input contains a single integer -- the target constant .

输出格式

Output a Java2016 program that successfully evaluates to constant with probability no less than . total length of the program should not exceed characters (excluding spaces).

样例

样例输入 1

0

样例输出 1

? /?/ ?

样例输入 2

1

样例输出 2

a = ? max ?
(a max a) / a

数据范围与提示

Time limit: 2 s, Memory limit: 512 MB.