import sys

import random

n = int(sys.stdin.readline())

def generate_routes():
    for c1 in range(0, n):
        for c2 in range(c1 + 1, n):
            are_connected = random.random() < 0.6
            construction_cost = random.randint(1, 20)
            yield (c1, c2, are_connected, construction_cost)

print(n)

for (c1, c2, are_connected, construction_cost) in generate_routes():
    print(str(c1) + " " +
          str(c2) + " " +
          ("1 " if are_connected else "0 ") +
          str(construction_cost))

f1438c4bee2ec59dcf1a5cd3ad34e016915768b7
<mask token>


def generate_routes():
    for c1 in range(0, n):
        for c2 in range(c1 + 1, n):
            are_connected = random.random() < 0.6
            construction_cost = random.randint(1, 20)
            yield c1, c2, are_connected, construction_cost


<mask token>

<mask token>


def generate_routes():
    for c1 in range(0, n):
        for c2 in range(c1 + 1, n):
            are_connected = random.random() < 0.6
            construction_cost = random.randint(1, 20)
            yield c1, c2, are_connected, construction_cost


print(n)
for c1, c2, are_connected, construction_cost in generate_routes():
    print(str(c1) + ' ' + str(c2) + ' ' + ('1 ' if are_connected else '0 ') +
        str(construction_cost))

<mask token>
n = int(sys.stdin.readline())


def generate_routes():
    for c1 in range(0, n):
        for c2 in range(c1 + 1, n):
            are_connected = random.random() < 0.6
            construction_cost = random.randint(1, 20)
            yield c1, c2, are_connected, construction_cost


print(n)
for c1, c2, are_connected, construction_cost in generate_routes():
    print(str(c1) + ' ' + str(c2) + ' ' + ('1 ' if are_connected else '0 ') +
        str(construction_cost))

import sys
import random
n = int(sys.stdin.readline())


def generate_routes():
    for c1 in range(0, n):
        for c2 in range(c1 + 1, n):
            are_connected = random.random() < 0.6
            construction_cost = random.randint(1, 20)
            yield c1, c2, are_connected, construction_cost


print(n)
for c1, c2, are_connected, construction_cost in generate_routes():
    print(str(c1) + ' ' + str(c2) + ' ' + ('1 ' if are_connected else '0 ') +
        str(construction_cost))

import sys

import random

n = int(sys.stdin.readline())

def generate_routes():
    for c1 in range(0, n):
        for c2 in range(c1 + 1, n):
            are_connected = random.random() < 0.6
            construction_cost = random.randint(1, 20)
            yield (c1, c2, are_connected, construction_cost)

print(n)

for (c1, c2, are_connected, construction_cost) in generate_routes():
    print(str(c1) + " " +
          str(c2) + " " +
          ("1 " if are_connected else "0 ") +
          str(construction_cost))
