This page is still under construction.

Parts of this page are still being built. What you see may change.

Hello World!

Time limit1sMemory limit32 MB

Summary
Assign distinct digits to the seven letters in hello + world so the sum equals N, then print the smallest hello in a column format.
Level

Medium4 of 10

Topics
Brute force, Math, Implementation
Solved
No attempts yet

Problem

You are given a positive integer NN. Assign one digit to each of the seven letters d, e, h, l, o, r, w so that the addition below holds.

hello+world=N\text{hello} + \text{world} = N

Here hello is the five digit number whose digits from the most significant one are h, e, l, l, o, and world is the five digit number whose digits from the most significant one are w, o, r, l, d. The digits assigned to the seven letters are pairwise different, and the leading digits h and w cannot be 0.

Input

The first line contains a positive integer NN. NN fits in the range of a 32 bit signed integer.

Output

If no assignment satisfies the equation, print No Answer.

Otherwise take the assignment whose hello is smallest and print four lines. Let LL be the number of digits of NN and let W=L+2W = L + 2.

  1. On the first line print hello right aligned in a field of width WW.
  2. On the second line print +, then world right aligned in a field of width W−1W - 1.
  3. On the third line print the character - exactly WW times.
  4. On the fourth line print NN right aligned in a field of width WW.

Right aligned means the number is padded on the left with spaces until it reaches the given width.

Examples2

  1. Example 1

    Input
    66971
    
    Expected output
      12334
    + 54637
    -------
      66971
    
  2. Example 2

    Input
    199991
    
    Expected output
    No Answer