Problem:
Score : 600 points

Problem Statement

Snuke has an integer sequence, a, of length N. The i-th element of a (1-indexed) is a_{i}.

He can perform the following operation any number of times:

Operation: Choose integers x and y between 1 and N (inclusive), and add a_x to a_y.

He would like to perform this operation between 0 and 2N times (inclusive) so that a satisfies the condition below. Show one such sequence of operations.
It can be proved that such a sequence of operations always exists under the constraints in this problem.

Condition: a_1 \leq a_2 \leq ... \leq a_{N}

Constraints

2 \leq N \leq 50

-10^{6} \leq a_i \leq 10^{6}

All input values are integers.

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 ... a_{N}

Output

Let m be the number of operations in your solution. In the first line, print m.
In the i-th of the subsequent m lines, print the numbers x and y chosen in the i-th operation, with a space in between.
The output will be considered correct if m is between 0 and 2N (inclusive) and a satisfies the condition after the m operations.

Sample Input 1

3
-2 5 -1

Sample Output 1

2
2 3
3 3

After the first operation, a = (-2,5,4).

After the second operation, a = (-2,5,8), and the condition is now satisfied.

Sample Input 2

2
-1 -3

Sample Output 2

1
2 1

After the first operation, a = (-4,-3) and the condition is now satisfied.

Sample Input 3

5
0 0 0 0 0

Sample Output 3

0

The condition is satisfied already in the beginning.

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>
 
#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;
 
#define pb(x) push_back(x)  
#define rep(i,n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define len(p) (sizeof(p)/sizeof(*p))
#define debug(x) cerr << #x << ": " << x << '\n'; 
// #define int long long
 
typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;
template <class T> void print(T x){ cout << x << '\n'; }
template <class T> void print(T *x, size_t l){ rep(i,l){cout << *(x+i) << ' ';} cout << '\n'; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) { int len = v.size(); for (int i = 0; i < len; ++i) { s << v[i]; if (i < len - 1) s << " "; } return s; }
 

int n;
int *a;
int c;
vector<pii> operations;

void dump(){
    cout << c << endl;
    for(auto it = operations.begin(); it != operations.end(); it++){
        cout << it->first << " " << it->second << endl;
    }
}

void solveMinus(){
    for(int i = n-1; i >= 1; i--){
        if (a[i] > a[i+1]) {
            c++;
            operations.pb(make_pair(i+1, i));
            a[i] += a[i+1];
        }
    }
    dump();
}
void solvePlus(){
    rep(j, n-1) {
        int i = j+1;
        // cout << i << endl;
        if (a[i] > a[i+1]) {
            c++;
            operations.pb(make_pair(i, i+1));
            a[i+1] += a[i];
        }
    }
    dump();
}

signed main(void){
    cin >> n;
    a = new int[n+2];
    rep(i, n) cin >> a[i+1];

    int count = 0;

    int ma = a[1], mi = a[1];
    int mai = 1, mii = 1;
    rep(j, n) {
        int i = j+1;
        if (ma < a[i]) {ma = a[i]; mai = i;}
        if (mi > a[i]) {mi = a[i]; mii = i;}
    }
    if (mi >= 0) solvePlus(); 
    else if (ma <= 0) solveMinus();
    else {
        c = n;
        if( ma > -mi) {
            for(int i = 1; i <= n; i++)
                operations.pb(make_pair(mai, i));
            solvePlus();
        }
        else{
            for(int i = 1; i <= n; i++)
                operations.pb(make_pair(mii, i));
            solveMinus();
        }
    }
}