Evaluate It and Back Again

면접 대비

시간 제한3초메모리 제한2048 MB

요약
왼쪽에서 오른쪽으로 읽으면 p, 오른쪽에서 왼쪽으로 읽으면 q가 되는, 길이 1000 이하의 산술식을 만든다.
난이도

보통10점 중 7점

유형
수학, 구현, 그리디
정답자
아직 제출이 없습니다

문제

Aidan and Nadia are long-time friends with a shared passion for mathematics. Each of them has a favorite number: Aidan's favorite number is pp, and Nadia's is qq.

To commemorate their friendship, their friends want to make a present: a plaque with an arithmetic expression whose value is equal to their favorite numbers. At first glance, it sounds impossible, but the answer is simple: Aidan reads left-to-right, while Nadia reads right-to-left, so the same expression can have different values for them.

For example, if 2023-12-13 is written on the plaque, then Aidan would calculate the result as 2023−12−13=19982023-12-13 = 1998, and Nadia would calculate it as 31−21−3202=−319231-21-3202=-3192.

Find an arithmetic expression that, when read left-to-right, evaluates to pp, and, when read right-to-left, evaluates to qq. Its length must be at most 10001000 characters. It's guaranteed that such an expression exists for all valid inputs.

입력

The first line of the input contains two integers pp and qq (−1018≤p,q≤1018-10^{18} \le p, q \le 10^{18}).

출력

Print the expression without spaces or line breaks. It can only contain digits 0 through 9, '+', '-', and '*' characters.

The expression must contain at most 10001000 characters. Leading zeros in numbers are not allowed (the only exception is the notation '0' representing the number 00) in both the expression and its reverse. Use of unary '+' or '-' is not allowed. The expression must be well-formed in both directions. The calculation uses the standard operator precedence.

예제2

  1. 예제 1

    입력
    1998 -3192
    
    예상 출력
    2023-12-13
    
  2. 예제 2

    입력
    413 908
    
    예상 출력
    12*34+5