atcoder#AGC047E. [AGC047E] Product Simulation

[AGC047E] Product Simulation

Score : 18001800 points

Problem Statement

This is an output-only problem. You shouldn't read anything from the input.

In short, your task is to simulate multiplication by using only comparison (x<y)(x < y) and addition (x+y)(x + y). There is no input in this problem, you just print a sequence of operations.

Imagine that there is a big array a[0],a[1],...,a[N1]a[0], a[1], ..., a[N-1] of length NN. The first two values are initially two non-negative integers AA and BB (which are unknown to you), the other elements are zeros. Your goal is to get the product ABA \cdot B in a[2]a[2] at the end.

You are allowed operations of two types, with the following format (where 0i,j,k<N0 \leq i, j, k < N):

  • + i j k — applies operation a[k]=a[i]+a[j]a[k] = a[i] + a[j].
  • < i j k — applies operation a[k]=a[i]<a[j]a[k] = a[i] < a[j]. That is, if a[i]<a[j]a[i] < a[j] then a[k]a[k] becomes 11, otherwise it becomes 00.

You can use at most QQ operations. Elements of aa can't exceed VV. Indices (i,j,k)(i, j, k) don't have to be distinct. It's allowed to modify any element of the array (including the first two). The actual checker simulates the process for multiple pairs (A,B)(A, B) within a single test. Each time, the checker chooses values AA and BB, creates the array a=[A,B,0,0,,0]a = [A, B, 0, 0, \ldots, 0], applies all your operations and ensures that a[2]=ABa[2] = A \cdot B.

Constraints

  • 0A,B1090 \leq A, B \leq 10^9
  • N=Q=200000N = Q = 200\,000
  • V=1019=10000000000000000000V = 10^{19} = 10\,000\,000\,000\,000\,000\,000

Partial Score

  • 800800 points will be awarded for passing tests that satisfy A,B10A, B \leq 10.
  • Another 10001000 points will be awarded for passing all tests.

Input

The Standard Input is empty.

Output

In the first line, print the number of operations. Each operation should then be printed in a single line of format + i j k or < i j k.


4
< 0 1 8
+ 0 1 2
+ 2 8 2
+ 0 0 0

In the first sample test, the checker checks your sequence only for a pair (A,B)=(2,3)(A, B) = (2, 3). The provided output is correct for this test:

  • Initially, a[0]=2a[0] = 2, a[1]=3a[1] = 3, a[2]=a[3]==a[N1]=0a[2] = a[3] = \ldots = a[N-1] = 0.
  • < 0 1 8 applies a[8]=1a[8] = 1 because a[0]<a[1]a[0] < a[1].
  • + 0 1 2 applies a[2]=a[0]+a[1]=5a[2] = a[0] + a[1] = 5.
  • + 2 8 2 applies a[2]=a[2]+a[8]=6a[2] = a[2] + a[8] = 6.
  • + 0 0 0 applies a[0]=a[0]+a[0]=4a[0] = a[0] + a[0] = 4.
  • As required, at the end we have a[2]=6=ABa[2] = 6 = A \cdot B.