50039. Inner Product and Outer Product

I'm a slow walker, but I never walk backwards.

Task Description

Given two vector $(a, b, c)$ and $(d, e, f)$, output their inner product in the first line of output, and their cross product at the second line. All the numbers are between $-100$ and $100$.

Input Format

The input contains only one test case. The first line of input contains six integers $a, b, c, d, e, f$ ($-100 \lt a, b, c, d, e, f \lt 100$).

Output Format

Print two lines for each test case. The first line contains one integer, representing the inner product of two vector. The second line contains three integers, representing the outer product vector of them.

Sample Input 1

1 2 3 4 5 6

Sample Output 1

32
-3 6 -3

Sample Input 2

1 -3 2 -2 1 3

Sample Output 2

1
-11 -7 -5

Hint

$$ \overrightarrow{a} = (a_1, a_2, a_3), \; \overrightarrow{b} = (b_1, b_2, b_3), \; \overrightarrow{a} \cdot \overrightarrow{b} = a_1 b_1 + a_2 b_2 + a_3 b_3 $$

$$ \overrightarrow{a} = (a_1, a_2, a_3), \; \overrightarrow{b} = (b_1, b_2, b_3), \; \overrightarrow{a} \times \overrightarrow{b} = \begin{pmatrix} a_2b_3 - a_3b_2 ,& a_3b_1 - a_1b_3 ,& a_1b_2 - a_2b_1 \end{pmatrix} $$

Discussion