#! /usr/bin/env python3

import itertools
import sys


INPUT = [int(l) for l in sys.stdin.readline().split()]


def p1():
    inp = INPUT[:]
    sets = []

    while inp not in sets:
        sets.append(inp[:])
        m = max(inp)
        i = inp.index(m)
        inp[i] = 0

        while m:
            i = (i + 1) % len(inp)
            inp[i] += 1
            m -= 1

    return len(sets), len(sets) - sets.index(inp)

def main():
    print(list(p1()))


if __name__ == '__main__':
    main()


71d2e6f6b0789cc33f692eda91188dee6539ffe1
<mask token>


def p1():
    inp = INPUT[:]
    sets = []
    while inp not in sets:
        sets.append(inp[:])
        m = max(inp)
        i = inp.index(m)
        inp[i] = 0
        while m:
            i = (i + 1) % len(inp)
            inp[i] += 1
            m -= 1
    return len(sets), len(sets) - sets.index(inp)


def main():
    print(list(p1()))


<mask token>

<mask token>


def p1():
    inp = INPUT[:]
    sets = []
    while inp not in sets:
        sets.append(inp[:])
        m = max(inp)
        i = inp.index(m)
        inp[i] = 0
        while m:
            i = (i + 1) % len(inp)
            inp[i] += 1
            m -= 1
    return len(sets), len(sets) - sets.index(inp)


def main():
    print(list(p1()))


if __name__ == '__main__':
    main()

<mask token>
INPUT = [int(l) for l in sys.stdin.readline().split()]


def p1():
    inp = INPUT[:]
    sets = []
    while inp not in sets:
        sets.append(inp[:])
        m = max(inp)
        i = inp.index(m)
        inp[i] = 0
        while m:
            i = (i + 1) % len(inp)
            inp[i] += 1
            m -= 1
    return len(sets), len(sets) - sets.index(inp)


def main():
    print(list(p1()))


if __name__ == '__main__':
    main()

import itertools
import sys
INPUT = [int(l) for l in sys.stdin.readline().split()]


def p1():
    inp = INPUT[:]
    sets = []
    while inp not in sets:
        sets.append(inp[:])
        m = max(inp)
        i = inp.index(m)
        inp[i] = 0
        while m:
            i = (i + 1) % len(inp)
            inp[i] += 1
            m -= 1
    return len(sets), len(sets) - sets.index(inp)


def main():
    print(list(p1()))


if __name__ == '__main__':
    main()

#! /usr/bin/env python3

import itertools
import sys


INPUT = [int(l) for l in sys.stdin.readline().split()]


def p1():
    inp = INPUT[:]
    sets = []

    while inp not in sets:
        sets.append(inp[:])
        m = max(inp)
        i = inp.index(m)
        inp[i] = 0

        while m:
            i = (i + 1) % len(inp)
            inp[i] += 1
            m -= 1

    return len(sets), len(sets) - sets.index(inp)

def main():
    print(list(p1()))


if __name__ == '__main__':
    main()

