Under construction

Still being built. Things may change

Strange Multiplication

Interview

Time limit2sMemory limit256 MB

Summary
Given two large numbers as digit strings, compute the sum of all pairwise products of their digits, which equals the product of their digit sums.
Level

Easy3 of 10

Topics
Math, String, Implementation
Solved
No attempts yet

Problem

You are given two non-negative integers A and B. Instead of ordinary multiplication, define a new value as follows: choose one digit from A and one digit from B, multiply those two digits, and add the products over every possible pair of chosen digits.

If A has n digits and B has m digits, there are n × m pairs. For 121 and 34, the calculation is:

1×3 + 1×4 + 2×3 + 2×4 + 1×3 + 1×4 = 28

Compute this value for the two given numbers.

Input

The first line contains two non-negative integers A and B, separated by a space. Each number has at most 10,000 digits.

If a number is zero, it is given as exactly 0. Otherwise, a number does not start with 0.

Output

Print the multiplication result defined in the statement.

Examples1

  1. Example 1

    Input
    123 45
    
    Expected output
    54