#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <random>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
constexpr lnt INF = 2e18;
/*-*/

template <typename T>
std::vector<int> sort_indexes(const std::vector<T> &v) {
  std::vector<int> idx(v.size());
  std::iota(idx.begin(), idx.end(), 0);
  std::sort(idx.begin(), idx.end(), [&v](int i1, int i2) {return v[i1] < v[i2];});
  return idx;
}

struct T
{
	int a,b,c;
	T(int a, int b, int c) : a(a),b(b),c(c) {}
};

int main() {
	int n;
	std::cin >> n;
	std::vector<int> r(n);
	rep(i,n) std::cin >> r[i];
	std::vector<T> teams;
	rep(i,n) {
		int a,b,c;
		std::cin >> a >> b >> c;
		teams.emplace_back(a,b,c);
	}
	auto calc = [&] (T a) -> int {
		std::vector<T> tc = teams;
		tc[0]=a;
		std::vector<std::vector<int> > v(3,std::vector<int>(n));
		rep(i,3) std::iota(all(v[i]),0);
		std::sort(all(v[0]),[&tc](int i1, int i2) {return tc[i1].a > tc[i2].a;});
		std::sort(all(v[1]),[&tc](int i1, int i2) {return tc[i1].b > tc[i2].b;});
		std::sort(all(v[2]),[&tc](int i1, int i2) {return tc[i1].c > tc[i2].c;});
		std::vector<int> score(n,0);
		std::vector<std::vector<int> > rr(3,std::vector<int>(n));
		rep(j,3) {
			if(j==0) {
				for(int i=0;i<n;) {
					int start =i;
					while(i<n&&tc[v[j][i]].a==tc[v[j][start]].a){
						rr[j][i] = r[start];
						i++;
					}
				}
			}
			if(j==1) {
				for(int i=0;i<n;){
					int start =i;
					while(i<n&&tc[v[j][i]].b==tc[v[j][start]].b){
						rr[j][i] = r[start];
						i++;
					}
				}
			}
			if(j==2) {
				for(int i=0;i<n;) {
					int start =i;
					while(i<n&&tc[v[j][i]].c==tc[v[j][start]].c){
						rr[j][i] = r[start];
						i++;
					}
				}
			}
		}
		rep(i,n) {
			rep(j,3) {
				score[v[j][i]]+=rr[j][i];
			}
		}
		int base = score[0];
		std::sort(all(score));
		auto ub = std::upper_bound(all(score),base);
		int rank = (score.end()-ub)+1;
		return rank;
	};
	// do for a,b,c
	// a
	int min = 10000;
	bool impossible=true;
	{
		int check = calc(T(1000,teams[0].b,teams[0].c));
		if(check<9) {
			impossible=false;
			int L=-1, R=1000;
			while(R-L>1) {
				int o=(L+R)>>1;
				T xx = teams[0];
				xx.a+=o;
				int rank = calc(xx);
				if(rank<9) R=o;
				else L=o;
			}
			min=std::min(min,R);
		}
	}
	{
		T yy=teams[0];
		yy.b=1000;
		int check = calc(yy);
		if(check<9) {
			impossible=false;
			int L=-1, R=1000;
			while(R-L>1) {
				int o=(L+R)>>1;
				T xx = teams[0];
				xx.b+=o;
				int rank = calc(xx);
				if(rank<9) R=o;
				else L=o;
			}
			min=std::min(min,R);
		}
	}
	{
		T yy=teams[0];
		yy.c=1000;
		int check = calc(yy);
		if(check<9) {
			impossible=false;
			int L=-1, R=1000;
			while(R-L>1) {
				int o=(L+R)>>1;
				T xx = teams[0];
				xx.c+=o;
				int rank = calc(xx);
				if(rank<9) R=o;
				else L=o;
			}
			min=std::min(min,R);
		}
	}
	if(impossible) print("Saiko");
	else print(min);
}



Measured memory_bytes: 3168