Buggy python submission (verdict: Runtime Error):
import math
def calcH(O):
    n = len(O)
    return sum(-O.count(x)*1.0/n*math.log(O.count(x)*1.0/n) for x in set(O))
    
M = 256
while 1:
    n = int(raw_input())
    if n == 0: break
    I = map(int,raw_input().split())
    H = 10**10
    for S in range(16):
        for A in range(16):
            for C in range(16):
                O = []
                R = S
                for i in range(n):
                    R = (A*R+C)%M
                    O.append((I[i]+R)%M)
                tH = calcH(O)
                if tH < H:
                    H = tH
                    ans = [S,A,C]
    print " ".join(map(str,ans))

Fixed submission:
import math,itertools as it
M = 256
while 1:
    N = int(raw_input())
    if N == 0: break
    H = 1e10
    I = map(int,raw_input().split())
    for S,A,C in it.product(range(16),repeat=3):
        R = S
        O = [0]*M
        for i in I:
            R = (A*R+C)%M
            O[(i+R)%M] += 1
        tmp = -sum(1.0*x/N*math.log(1.0*x/N,2) for x in O if x > 0)
        if tmp < H:
            H = tmp
            ans = [S,A,C]
    print " ".join(map(str,ans))

Buggy python submission (verdict: Runtime Error):
import math
def calcH(O):
    n = len(O)
    return sum(-O.count(x)*1.0/n*math.log(O.count(x)*1.0/n) for x in set(O))

M = 256
while 1:
    n = int(raw_input())
    if n == 0: break
    I = map(int,raw_input().split())
    H = 10**10
    for S in range(16):
        for A in range(16):
            for C in range(16):
                O = [0]*n
                R = S
                for i in range(n):
                    R = (A*R+C)%M
                    O[i] = (I[i]+R)%M
                tH = calcH(O)
                if tH < H:
                    H = tH
                    ans = [S,A,C]
    print " ".join(map(str,ans))

Fixed submission:
import math,itertools as it
M = 256
while 1:
    N = int(raw_input())
    if N == 0: break
    H = 1e10
    I = map(int,raw_input().split())
    for S,A,C in it.product(range(16),repeat=3):
        R = S
        O = [0]*M
        for i in I:
            R = (A*R+C)%M
            O[(i+R)%M] += 1
        tmp = -sum(1.0*x/N*math.log(1.0*x/N,2) for x in O if x > 0)
        if tmp < H:
            H = tmp
            ans = [S,A,C]
    print " ".join(map(str,ans))

Buggy python submission (verdict: Runtime Error):
import math
def calcH(O):
    n = len(O)
    return sum(-O.count(x)*1.0/n*math.log(O.count(x)*1.0/n) for x in set(O))

M = 256
while 1:
    n = int(raw_input())
    if n == 0: break
    I = map(int,raw_input().split())
    H = 10**10
    for S in range(16):
        for A in range(16):
            for C in range(16):
                O = [0]*n
                R = S
                for i in range(n):
                    R = (A*R+C)%M
                    O[i] = (I[i]+R)%M
                tH = calcH(O)
                if tH < H:
                    H = tH
                    ans = [S,A,C]
    print " ".join(map(str,ans))

Fixed submission:
import math,itertools as it
M = 256
while 1:
    N = int(raw_input())
    if N == 0: break
    H = 1e10
    I = map(int,raw_input().split())
    for S,A,C in it.product(range(16),repeat=3):
        R = S
        O = [0]*M
        for i in I:
            R = (A*R+C)%M
            O[(i+R)%M] += 1
        tmp = -sum(1.0*x/N*math.log(1.0*x/N,2) for x in O if x > 0)
        if tmp < H:
            H = tmp
            ans = [S,A,C]
    print " ".join(map(str,ans))

Buggy python submission (verdict: Runtime Error):
import math
M = 256
while 1:
    N = int(raw_input())
    if N == 0: break
    H = 10**10
    l = map(int,raw_input().split())
    for S in range(16):
        for A in range(16):
            for C in range(16):
                R = S
                O = [0]*N
                for i in range(N):
                    R = (A*R+C)%M
                    O[i] = (l[i]+R)%M
                tmp = -sum(1.0*O.count(x)/N*math.log(1.0*O.count(x)/N) for x in set(O))
                if tmp < H:
                    H = tmp
                    ans = [S,A,C]
    print " ".join(map(str,ans))

Fixed submission:
import math,itertools as it
M = 256
while 1:
    N = int(raw_input())
    if N == 0: break
    H = 1e10
    I = map(int,raw_input().split())
    for S,A,C in it.product(range(16),repeat=3):
        R = S
        O = [0]*M
        for i in I:
            R = (A*R+C)%M
            O[(i+R)%M] += 1
        tmp = -sum(1.0*x/N*math.log(1.0*x/N,2) for x in O if x > 0)
        if tmp < H:
            H = tmp
            ans = [S,A,C]
    print " ".join(map(str,ans))

Buggy python submission (verdict: Runtime Error):
import math
M = 256
while 1:
    N = int(raw_input())
    if N == 0: break
    H = 1
    l = map(int,raw_input().split())
    for S in range(16):
        for A in range(16):
            for C in range(16):
                R = S
                O = [0]*N
                for i in range(N):
                    R = (A*R+C)%M
                    O[i] = (l[i]+R)%M
                X = [O.count(i) for i in O]
                tmp = -sum(float(x)/N*math.log(float(x)/N) for x in X)
                if tmp < H:
                    H = tmp
                    ans = [S,A,C]
    print " ".join(map(str,ans))

Fixed submission:
import math,itertools as it
M = 256
while 1:
    N = int(raw_input())
    if N == 0: break
    H = 1e10
    I = map(int,raw_input().split())
    for S,A,C in it.product(range(16),repeat=3):
        R = S
        O = [0]*M
        for i in I:
            R = (A*R+C)%M
            O[(i+R)%M] += 1
        tmp = -sum(1.0*x/N*math.log(1.0*x/N,2) for x in O if x > 0)
        if tmp < H:
            H = tmp
            ans = [S,A,C]
    print " ".join(map(str,ans))

Buggy python submission (verdict: Runtime Error):
import math
M = 256
while 1:
    N = int(raw_input())
    if N == 0: break
    H = 1
    l = map(int,raw_input().split())
    for S in range(16):
        for A in range(16):
            for C in range(16):
                R = S
                O = [0]*N
                for i in range(N):
                    R = (A*R+C)%M
                    O[i] = (l[i]+R)%M
                X = [O.count(i) for i in set(O)]
                tmp = -sum(float(x)/N*math.log(float(x)/N) for x in X)
                if tmp < H:
                    H = tmp
                    ans = [S,A,C]
    print " ".join(map(str,ans))

Fixed submission:
import math,itertools as it
M = 256
while 1:
    N = int(raw_input())
    if N == 0: break
    H = 1e10
    I = map(int,raw_input().split())
    for S,A,C in it.product(range(16),repeat=3):
        R = S
        O = [0]*M
        for i in I:
            R = (A*R+C)%M
            O[(i+R)%M] += 1
        tmp = -sum(1.0*x/N*math.log(1.0*x/N,2) for x in O if x > 0)
        if tmp < H:
            H = tmp
            ans = [S,A,C]
    print " ".join(map(str,ans))

Buggy python submission (verdict: Runtime Error):
import math
M = 256
while 1:
    N = int(raw_input())
    if N == 0: break
    H = 1e32
    l = map(int,raw_input().split())
    for S in range(16):
        for A in range(16):
            for C in range(16):
                R = S
                O = [0]*N
                for i in range(N):
                    R = (A*R+C)%M
                    O[i] = (l[i]+R)%M
                X = [O.count(i) for i in set(O)]
                tmp = -sum(float(x)/N*math.log(float(x)/N) for x in X)
                if tmp < H:
                    H = tmp
                    ans = [S,A,C]
    print " ".join(map(str,ans))

Fixed submission:
import math,itertools as it
M = 256
while 1:
    N = int(raw_input())
    if N == 0: break
    H = 1e10
    I = map(int,raw_input().split())
    for S,A,C in it.product(range(16),repeat=3):
        R = S
        O = [0]*M
        for i in I:
            R = (A*R+C)%M
            O[(i+R)%M] += 1
        tmp = -sum(1.0*x/N*math.log(1.0*x/N,2) for x in O if x > 0)
        if tmp < H:
            H = tmp
            ans = [S,A,C]
    print " ".join(map(str,ans))

Buggy python submission (verdict: Runtime Error):
import math
M = 256
while 1:
    N = int(raw_input())
    if N == 0: break
    H = 1e10
    l = map(int,raw_input().split())
    for S in range(16):
        for A in range(16):
            for C in range(16):
                R = S
                O = [0]*N
                for i in range(N):
                    R = (A*R+C)%M
                    O[i] = (l[i]+R)%M
                X = [O.count(i) for i in set(O)]
                tmp = -sum(float(x)/N*math.log(float(x)/N,2) for x in X)
                if tmp < H:
                    H = tmp
                    ans = [S,A,C]
    print " ".join(map(str,ans))

Fixed submission:
import math,itertools as it
M = 256
while 1:
    N = int(raw_input())
    if N == 0: break
    H = 1e10
    I = map(int,raw_input().split())
    for S,A,C in it.product(range(16),repeat=3):
        R = S
        O = [0]*M
        for i in I:
            R = (A*R+C)%M
            O[(i+R)%M] += 1
        tmp = -sum(1.0*x/N*math.log(1.0*x/N,2) for x in O if x > 0)
        if tmp < H:
            H = tmp
            ans = [S,A,C]
    print " ".join(map(str,ans))