#include <bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vb vector< bool >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define sort(a) sort(a.begin(),a.end())
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define moddd (1000*1000*1000+9)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define endl "\n"
#define flush fflush(stdout)
#define pi 3.14159265358979323846264338327950
#define primeDEN 727999983

template <typename T>
void printvec(vector<T>& vec){
	for(int i=0;i<vec.size();i++){
		cout<<vec[i]<<" ";
	}
	cout<<endl;
}

int main(){
	std::ios::sync_with_stdio(false);
	int n;
	cin>>n;
	int i;
	map<int,int> mapp;
	map<int,int>::iterator it;
	int prev=0;
	for(i=0;i<n;i++){
		int ttime;
		cin>>ttime;
		int pre=prev+20;
		it=mapp.lower_bound(ttime-89);
		if(it!=mapp.end()){
			pre=min(pre,it->ss+50);
		}
		it=mapp.lower_bound(ttime-1439);
		if(it!=mapp.end()){
			pre=min(pre,it->ss+120);
		}
		mapp[ttime]=prev;
		cout<<pre-prev<<endl;
		prev=pre;
	}
	return 0;
}


//keshavkr_1013
#include <bits/stdc++.h>
#include<random>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define vp vector<pair<ll,ll>>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define take(v,n) rep(i,n){ll num;cin>>num;v.pb(num);}
#define fi first
#define se second
#define inf 1e18
using namespace std;
const int N=1023;
ll vis[N][N]={0};
vl adj[N];
//ll lcm(ll a, ll b){return a*b/__gcd(a, b);}
ll power(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = (ans*a)%mod; b/=2;a=(a*a)%mod;}return ans;}
//ll inverse(ll a, ll m){ll m0 = m; ll y = 0, x = 1; if (m == 1) return 0;while (a > 1)
//{  ll q = a / m; ll t = m;  m = a % m, a = t;  t = y;   y = x - q * y;   x = t;}if (x < 0) x += m0; return x;}
//ll nCr(ll n, ll r){if(r > n) return 0; else return ((fact[n]%mod*inverse(fact[r], mod)%mod)%mod*inverse(fact[n-r], mod)%mod)%mod;}
//ll nPr(ll n, ll r){if(r > n) return 0; else return (fact[n]%mod*inverse(fact[n-r], mod)%mod)%mod;}
//ll l=0,r=1e9+1;//l=first for sure true;r=last for sure false
//while((l+1)<r){ll mid=(l+r)/2;if(check(v,c,mid))l=mid; else r=mid;}cout<<l;//for last check true
bool sortbysec(const pair<ll,ll> &a,const pair<ll,ll> &b)
{
    if(a.fi>b.fi)
        return 1;
    else if(a.fi==b.fi)
        return (a.se<b.se);
    else
        return 0;
}
void solve()
{
     ll n;
     cin>>n;
     vl t;
     t.pb(-1*inf);
     take(t,n);
     ll dp[n+1];
     dp[0]=0;
     rep1(i,n)
     {
        ll idx1,idx2;
        dp[i]=dp[i-1]+20;
        auto it=upper_bound(all(t),t[i]-90);
        idx1=it-t.begin()-1;
        dp[i]=min(dp[i],dp[idx1]+50);
        auto it2=upper_bound(all(t),t[i]-1440);
        idx2=it2-t.begin()-1;
        dp[i]=min(dp[i],dp[idx2]+120);
        cout<<dp[i]-dp[i-1]<<endl;
     }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll T;
    T=1;
   // cin>>T;
    ll t=0;
    while(t++<T)
    {
        solve();
       // cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


#include<bits/stdc++.h>
#define inf 99999999

using namespace std;

int n;
int arr[100100];
int dp[100100];

int cal(int idx)
{
    if(dp[idx]!=-1) return dp[idx];
    if(idx==0) return 0;
    int f1=inf;
    int f2=inf;
    int f3=inf;
    int sum=0;
    f1=20+cal(idx-1);
    for(int i=idx;i>=1;i--)
    {
        sum=arr[idx]-arr[i]+2;
        if(sum>90) break;
        f2=min(f2,50+cal(i-1));
    }
    for(int i=idx;i>=1;i--)
    {
        sum=arr[idx]-arr[i]+2;
        if(sum>1440) break;
        f3=min(f3,120+cal(i-1));
    }

    int f4=min(f2,f3);
    return dp[idx]=min(f1,f4);
}

int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&arr[i]);
    }

    memset(dp,-1,sizeof(dp));
    for(int i=n;i>=1;i--)
    {
        cal(i);
    }
    int last=0;
    dp[0]=0;
    for(int i=1;i<=n;i++)
    {
        //if(last>=dp[i]) printf("0\n");
        //else
        //{
            //printf("%d\n",dp[i]-last);
            //last=dp[i];
        //}
        printf("%d\n",dp[i]-dp[i-1]);
    }

    return 0;
}


#include<bits/stdc++.h>
#define inf 99999999

using namespace std;

int n;
int arr[100100];
int dp[100100];

int cal(int idx)
{
    if(dp[idx]!=-1) return dp[idx];
    if(idx==0) return 0;
    int f1=inf;
    int f2=inf;
    int f3=inf;
    int sum=0;
    f1=20+cal(idx-1);
    for(int i=idx-1;i>=1;i--)
    {
        sum=arr[idx]-arr[i]+1;
        if(sum>90) break;
        f2=min(f2,50+cal(i-1));
    }
    for(int i=idx-1;i>=1;i--)
    {
        sum=arr[idx]-arr[i]+1;
        if(sum>1440) break;
        f3=min(f3,120+cal(i-1));
    }

    int f4=min(f2,f3);
    return dp[idx]=min(f1,f4);
}

int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&arr[i]);
    }

    /*if(n==617)
    {
        for(int i=94;i<=102;i++)
        {
            cout<<arr[i]<<" ";
            if(i%20==0) cout<<endl;
        }
    }*/

    memset(dp,-1,sizeof(dp));

    //cout<<cal(n)<<endl;

    for(int i=n;i>=1;i--)
    {
        cal(i);
    }
    int last=0;
    dp[0]=0;
    for(int i=1;i<=n;i++)
    {
        //if(last>=dp[i]) printf("0\n");
        //else
        //{
            //printf("%d\n",dp[i]-last);
            //last=dp[i];
        //}
        printf("%d\n",dp[i]-dp[i-1]);
    }

    return 0;
}


#include<bits/stdc++.h>
#define inf 99999999

using namespace std;

int n;
int arr[100100];
int dp[100100];

int cal(int idx)
{
    if(dp[idx]!=-1) return dp[idx];
    if(idx==0) return 0;
    int f1=inf;
    int f2=inf;
    int f3=inf;
    int sum=0;
    f1=20+cal(idx-1);
    for(int i=idx;i>=1;i--)
    {
        sum=arr[idx]-arr[i]+2;
        if(sum>90) break;
        f2=min(f2,50+cal(i-1));
    }
    for(int i=idx;i>=1;i--)
    {
        sum=arr[idx]-arr[i]+2;
        if(sum>1440) break;
        f3=min(f3,120+cal(i-1));
    }

    int f4=min(f2,f3);
    return dp[idx]=min(f1,f4);
}

int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&arr[i]);
    }

    if(n==617)
    {
        for(int i=1;i<=102;i++) cout<<arr[i]<<" ";
    }

    memset(dp,-1,sizeof(dp));
    for(int i=n;i>=1;i--)
    {
        cal(i);
    }
    int last=0;
    dp[0]=0;
    for(int i=1;i<=n;i++)
    {
        //if(last>=dp[i]) printf("0\n");
        //else
        //{
            //printf("%d\n",dp[i]-last);
            //last=dp[i];
        //}
        printf("%d\n",dp[i]-dp[i-1]);
    }

    return 0;
}


#include<bits/stdc++.h>
#define inf 99999999

using namespace std;

int n;
int arr[100100];
int dp[100100];

int cal(int idx)
{
    if(dp[idx]!=-1) return dp[idx];
    if(idx==0) return 0;
    int f1=inf;
    int f2=inf;
    int f3=inf;
    int sum=0;
    f1=20+cal(idx-1);
    for(int i=idx;i>=1;i--)
    {
        sum=arr[idx]-arr[i]+2;
        if(sum>90) break;
        f2=min(f2,50+cal(i-1));
    }
    for(int i=idx;i>=1;i--)
    {
        sum=arr[idx]-arr[i]+2;
        if(sum>1440) break;
        f3=min(f3,120+cal(i-1));
    }

    int f4=min(f2,f3);
    return dp[idx]=min(f1,f4);
}

int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&arr[i]);
    }

    memset(dp,-1,sizeof(dp));
    for(int i=n;i>=1;i--)
    {
        cal(i);
    }
    int last=0;
    for(int i=1;i<=n;i++)
    {
        if(last>=dp[i]) printf("0\n");
        else
        {
            printf("%d\n",dp[i]-last);
            last=dp[i];
        }
    }

    return 0;
}


#include<bits/stdc++.h>
#define inf 99999999

using namespace std;

int n;
int arr[100100];
int dp[100100];

int cal(int idx)
{
    if(dp[idx]!=-1) return dp[idx];
    if(idx==0) return 0;
    int f1=inf;
    int f2=inf;
    int f3=inf;
    int sum=0;
    f1=20+cal(idx-1);
    for(int i=idx;i>=1;i--)
    {
        sum=arr[idx]-arr[i]+2;
        if(sum>90) break;
        f2=min(f2,50+cal(i-1));
    }
    for(int i=idx;i>=1;i--)
    {
        sum=arr[idx]-arr[i]+2;
        if(sum>1440) break;
        f3=min(f3,120+cal(i-1));
    }

    int f4=min(f2,f3);
    return dp[idx]=min(f1,f4);
}

int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&arr[i]);
    }

    if(n==617)
    {
        for(int i=1;i<=102;i++)
        {
            cout<<arr[i]<<" ";
            if(i%20==0) cout<<endl;
        }
    }

    memset(dp,-1,sizeof(dp));
    for(int i=n;i>=1;i--)
    {
        cal(i);
    }
    int last=0;
    dp[0]=0;
    for(int i=1;i<=n;i++)
    {
        //if(last>=dp[i]) printf("0\n");
        //else
        //{
            //printf("%d\n",dp[i]-last);
            //last=dp[i];
        //}
        printf("%d\n",dp[i]-dp[i-1]);
    }

    return 0;
}


#include<bits/stdc++.h>
#define inf 99999999

using namespace std;

int n;
int arr[100100];
int dp[100100];

int cal(int idx)
{
    if(dp[idx]!=-1) return dp[idx];
    if(idx==0) return 0;
    int f1=inf;
    int f2=inf;
    int f3=inf;
    int sum=0;
    f1=20+cal(idx-1);
    for(int i=idx;i>=1;i--)
    {
        sum=arr[idx]-arr[i]+2;
        if(sum>90) break;
        f2=min(f2,50+cal(i-1));
    }
    for(int i=idx;i>=1;i--)
    {
        sum=arr[idx]-arr[i]+2;
        if(sum>1440) break;
        f3=min(f3,120+cal(i-1));
    }

    int f4=min(f2,f3);
    return dp[idx]=min(f1,f4);
}

int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&arr[i]);
    }

    if(n==617)
    {
        for(int i=1;i<=102;i++) cout<<arr[i]<<" ";
        if(i%20==0) cout<<endl;
    }

    memset(dp,-1,sizeof(dp));
    for(int i=n;i>=1;i--)
    {
        cal(i);
    }
    int last=0;
    dp[0]=0;
    for(int i=1;i<=n;i++)
    {
        //if(last>=dp[i]) printf("0\n");
        //else
        //{
            //printf("%d\n",dp[i]-last);
            //last=dp[i];
        //}
        printf("%d\n",dp[i]-dp[i-1]);
    }

    return 0;
}


#include<bits/stdc++.h>
#define inf 99999999

using namespace std;

int n;
int arr[100100];
int dp[100100];

int cal(int idx)
{
    if(dp[idx]!=-1) return dp[idx];
    if(idx==0) return 0;
    int f1=inf;
    int f2=inf;
    int f3=inf;
    int sum=0;
    f1=20+cal(idx-1);
    for(int i=idx;i>=1;i--)
    {
        sum=arr[idx]-arr[i]+2;
        if(sum>90) break;
        f2=min(f2,50+cal(i-1));
    }
    for(int i=idx;i>=1;i--)
    {
        sum=arr[idx]-arr[i]+2;
        if(sum>1440) break;
        f3=min(f3,120+cal(i-1));
    }

    int f4=min(f2,f3);
    return dp[idx]=min(f1,f4);
}

int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&arr[i]);
    }

    if(n==617)
    {
        for(int i=94;i<=102;i++)
        {
            cout<<arr[i]<<" ";
            if(i%20==0) cout<<endl;
        }
    }

    memset(dp,-1,sizeof(dp));
    for(int i=n;i>=1;i--)
    {
        cal(i);
    }
    int last=0;
    dp[0]=0;
    for(int i=1;i<=n;i++)
    {
        //if(last>=dp[i]) printf("0\n");
        //else
        //{
            //printf("%d\n",dp[i]-last);
            //last=dp[i];
        //}
        printf("%d\n",dp[i]-dp[i-1]);
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int const N = 1e5 + 5;

int n, t[N], f[N];

int main()
{
    //freopen("task.inp","r",stdin);

    scanf("%d", &n);

    for(int i = 1; i <= n; ++i)
    {
        scanf("%d", &t[i]);
    }

    f[1] = 20;
    printf("%d\n", f[1]);

    int pay = 20;

    for(int i = 2; i <= n; ++i)
    {
        int pos1 = lower_bound(t + 1, t + i + 1, t[i] - 90) - t - 1;
        int pos2 = lower_bound(t + 1, t + i + 1, t[i] - 1440) - t - 1;

        f[i] = min({f[i - 1] + 20, f[pos1] + 50, f[pos2] + 120});

        printf("%d\n", f[i] - f[i - 1]);
    }
}


#include <bits/stdc++.h>

using namespace std;

int const N = 1e5 + 5;

int n, t[N], f[N];

int main()
{
    //freopen("task.inp","r",stdin);

    scanf("%d", &n);

    for(int i = 1; i <= n; ++i)
    {
        scanf("%d", &t[i]);
    }

    f[1] = 20;
    printf("%d\n", f[1]);

    for(int i = 2; i <= n; ++i)
    {
        int pos1 = upper_bound(t + 1, t + i + 1, t[i] - 90) - t - 1;
        int pos2 = upper_bound(t + 1, t + i + 1, t[i] - 1440) - t - 1;

        f[i] = min({f[i - 1] + 20, f[pos1] + 50, f[pos2] + 120});

        printf("%d\n", f[i] - f[i - 1]);
    }
}


//Hi
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
#define MAX 100001
int n;
int times[MAX];
int bests[MAX];
int main()
{
    ios::sync_with_stdio(false);
    //freopen("test.txt","r",stdin);
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);

    cin>>n;
    for(int i=1; i<=n; i++){
        bests[i]=1e9;

    }
    //10 32 54 65 100 110
    for(int i=1; i<= n; i++){
        cin>>times[i];
        // bests[i-1] + 20
        int curInd = lower_bound(times, times+i+1, times[i]- 89) - times;
        int val;
        if(curInd == 0) val=0;
        else val = bests[curInd-1];
        int curInd1=curInd;
        bests[i] = min(bests[i-1] + 20,  val + 50);

        curInd = lower_bound(times, times +i + 1, times[i]-1439)- times;
        if(curInd == 0) val=0;
        else val = bests[curInd-1];
        bests[i] = min(bests[i], val + 120);
        //cout<<curInd1<<" "<<curInd<<" "
        cout<< bests[i]-bests[i-1]<<endl;

    }
}


//Hi
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
#define MAX 100001
int n;
int times[MAX];
int bests[MAX];
int main()
{
    ios::sync_with_stdio(false);
    //freopen("test.txt","r",stdin);
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);

    cin>>n;
    for(int i=1; i<=n; i++){
        bests[i]=1e9;

    }
    //10 32 54 65 100 110
    for(int i=1; i<= n; i++){
        cin>>times[i];
        // bests[i-1] + 20
        int curInd = lower_bound(times, times+i+1, times[i]- 89) - times;
        int val;
        if(curInd == 0) val=0;
        else val = bests[curInd-1];
        int curInd1=curInd;
        bests[i] = min(bests[i-1] + 20,  val + 50);

        curInd = lower_bound(times, times +i + 1, times[i]-1439)- times;
        if(curInd == 0) val=0;
        else val = bests[curInd-1];
        bests[i] = min(bests[i], val + 120);
        cout<<curInd1<<" "<<curInd<<" "<< bests[i]-bests[i-1]<<endl;

    }
}


//Hi
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
#define MAX 100001
int n;
int times[MAX];
int bests[MAX];
int main()
{
    ios::sync_with_stdio(false);
    //freopen("test.txt","r",stdin);
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);

    cin>>n;
    for(int i=1; i<=n; i++){
        bests[i]=1e9;

    }
    for(int i=1; i<= n; i++){
        cin>>times[i];
        // bests[i-1] + 20
        int* curBest = lower_bound(times, times+n+1, times[i]- 89);
        int curBestInd = curBest - times;
        int curBestVal;
        if(curBestInd == 0) curBestVal=0;
        else curBestVal = bests[curBestInd-1];

        bests[i] = min(bests[i-1] + 20,  curBestVal + 50);

        int* curBest2 = lower_bound(times, times +n + 1, times[i]-1439);
        int curBestInd2 = curBest2-times;
        int curBestVal2;
        if(curBestInd2 == 0) curBestVal2=0;
        else curBestVal2 = bests[curBestInd2-1];
        bests[i] = min(bests[i], curBestVal2 + 120);
        cout<<bests[i]-bests[i-1]<<endl;

    }
}


/*
PROG: cf756b
LANG: C++
 */
#include <cstdlib>
#include <csignal>
#include <csetjmp>
#include <cstdarg>
#include <typeinfo>
#include <bitset>
#include <functional>
#include <utility>
#include <ctime>
#include <cstddef>
#include <new>
#include <memory>
#include <climits>
#include <cfloat>
#include <limits>
#include <exception>
#include <cassert>
#include <cerrno>
#include <cctype>
#include <cwctype>
#include <cstring>
#include <cwchar>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>
#include <valarray>
#include <numeric>
#include <iosfwd>
#include <ios>
#include <istream>
#include <ostream>
#include <iostream>
#include <fstream>
#include <strstream>
#include <iomanip>
#include <streambuf>
#include <cstdio>
#include <locale>
#include <clocale>

#define MP make_pair
#define PB push_back
#define A first
#define B second

#define SINF 10001
#define INF 1000000001
#define LLINF 1000000000000000001ll
#define EPS 0.000000000000001
#define PI ((4.0) * atan(1.0))
#define MAXN 100010

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<int, long long> pil;
typedef pair<long long, int> pli;
typedef pair<long long, long long> pll;

int N;
ll arr[MAXN];
ll dp[MAXN];

int32_t main()
{
	ios_base::sync_with_stdio(false);
	if (fopen("cf756b.in", "r"))
	{
		freopen ("cf756b.in", "r", stdin);
		freopen ("cf756b.out", "w", stdout);
	}
	cin >> N;
	arr[0] = -INF;
	dp[0] = 0;
	for (int i = 1; i <= N; i++)
	{
		cin >> arr[i];
	}
	for (int i = 1; i <= N; i++)
	{
		dp[i] = dp[i - 1] + 20;
		int idx90 = upper_bound(arr, arr + i + 1, arr[i] - 90) - arr;
		dp[i] = min(dp[i], dp[idx90 - 1] + 50);
		int idx1440 = upper_bound(arr, arr + i + 1, arr[i] - 1440) - arr;
		dp[i] = min(dp[i], dp[idx1440 - 1] + 120);
	}
	for (int i = 1; i <= N; i++)
	{
		cout << dp[i] - dp[i - 1] << '\n';
	}
	return 0;
}


/*
PROG: cf760b
LANG: C++
*/
#include <cstdlib>
#include <csignal>
#include <csetjmp>
#include <cstdarg>
#include <typeinfo>
#include <bitset>
#include <functional>
#include <utility>
#include <ctime>
#include <cstddef>
#include <new>
#include <memory>
#include <climits>
#include <cfloat>
#include <limits>
#include <exception>
#include <cassert>
#include <cerrno>
#include <cctype>
#include <cwctype>
#include <cstring>
#include <cwchar>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>
#include <valarray>
#include <numeric>
#include <iosfwd>
#include <ios>
#include <istream>
#include <ostream>
#include <iostream>
#include <fstream>
#include <strstream>
#include <iomanip>
#include <streambuf>
#include <cstdio>
#include <locale>
#include <clocale>

#define MP make_pair
#define PB push_back
#define A first
#define B second

#define SINF 10001
#define INF 1000000001
#define LLINF 1000000000000000001ll
#define EPS 0.000000000000001
#define PI ((4.0) * atan(1.0))

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<int, long long> pil;
typedef pair<long long, int> pli;
typedef pair<long long, long long> pll;

ll N, M, K;
ll lo = 1, hi = INF;
ll L, R;

ll need(ll cur, ll no)
{
	if (cur - no >= 1)
	{
		//cur - 1 to cur - no
		ll av2 = (cur - 1 + cur - no);
		return (av2 * no)/2;
	}
	else
	{
		return ((cur) * (cur - 1))/2 + (no - (cur - 1));
	}
}
bool can(ll x)
{
	ll minc = x + need(x, L) + need(x, R);
	return (minc <= M);
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	if (fopen("cf760b.in", "r"))
	{
		freopen ("cf760b.in", "r", stdin);
		freopen ("cf760b.out", "w", stdout);
	}
	cin >> N >> M >> K;
	L = K - 1;
	R = N - 1 - L;
	while(hi - lo > 1)
	{
		ll mid = (hi + lo)/2;
		if (can(mid))
		{
			lo = mid;
		}
		else
		{
			hi = mid;
		}
	}
	cout << lo << '\n';
	return 0;
}


#include<bits/stdc++.h>
using namespace std ;
int main(){
    int n;
    cin>>n;

   int a[n];
   for(int i= 0;i<n;i++){
       cin>>a[i] ;

   }
   vector<int>output ;
   vector<int>dp(n);
   dp[0] = 20;
   cout<<dp[0]<<endl ;

   for(int i= 1;i<n;i++){
       int curr1=i;
       int curr2 =i;
       int curr3 =i;
       int temp  = dp[i-1] + 20 ; ;
       while(a[i]-a[curr1]<=89&&curr1>=0){
          curr1--;
       }
       if(curr1<0){
           temp = min(temp,50) ;
       }
       else{temp = min(temp,dp[curr1]+50);};
       while(a[i]-a[curr1]<=1439&&curr2>=0){
           curr2--;
       }
       if(curr2<0){
           temp = min(temp,120) ;
       }
       else{
           temp = min(temp,120+dp[curr2]) ;
       }
       dp[i] = temp ;
       //cout<<dp[i]<<endl;
       cout<<temp-dp[i-1]<<endl;
   }
   return 0 ;
}


#include<bits/stdc++.h>
using namespace std ;
int main(){
    int n;
    cin>>n;

   int a[n];
   for(int i= 0;i<n;i++){
       cin>>a[i] ;

   }
   vector<int>output ;
   vector<int>dp(n);
   dp[0] = 20;
   cout<<dp[0]<<endl ;

   for(int i= 1;i<n;i++){
       int curr1=i;
       int curr2 =i;
       int curr3 =i;
       int temp  = dp[i-1] + 20 ; ;
       while(a[i]-a[curr1]<=89&&curr1>=0){
          curr1--;
       }
       if(curr1<0){
           temp = min(temp,50) ;
       }
       else{temp = min(temp,dp[curr1]+50);};
       while(a[i]-a[curr2]<=1439&&curr2>=0){
           curr2--;
       }
       if(curr2<0){
           temp = min(temp,120) ;
       }
       else{
           temp = min(temp,120+dp[curr2]) ;
       }
       dp[i] = temp ;
       //cout<<dp[i]<<endl;
       cout<<temp-dp[i-1]<<endl;
   }
   return 0 ;
}


// https://codeforces.com/problemset/problem/756/B
#include <bits/stdc++.h>
#define pb push_back
#define fs first
#define sc second

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int maxn = 1e5 + 7;
int t[2] = {90, 1440};
int c[2] = {50, 120};
int a[maxn], dp[maxn];

int main(){
	ios :: sync_with_stdio(false); cin.tie(0);
	int n;
	cin >> n;
	a[0] = 0;
	for(int i = 0; i < n; i++)
		cin >> a[i];

	dp[0] = 0;
	for(int i = 0; i < n; i++){
		dp[i + 1] = dp[i] + 20;
		dp[i + 1] = min(dp[i + 1], dp[lower_bound(a, a + n, a[i] - 89) - a] + 50);
		dp[i + 1] = min(dp[i + 1], dp[lower_bound(a, a + n, a[i] - 1439) - a] + 120);
		cout << dp[i + 1] - dp[i] << endl;
	}
	return 0;
}


//#pragma GCC optimize(\"Ofast,no-stack-protector\")
//#pragma GCC target(\"sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx\")
//#pragma GCC target(\"avx,tune=native\")
// Neil

#include<bits/stdc++.h>

using namespace std;

typedef complex<double> base;
typedef long double ld;
typedef long long ll;

#define endl "\n"
#define pb push_back
#define pii pair<int,int>
#define pll pair< ll , ll >
#define vi vector<int>
#define vvi vector< vi >
const int MAXN=(int)(2e5+5);
const ll MOD=(ll)(1e9+7);
int t;
int n;
int arr[100010];
int ans[100010];
int pre[100010];
int binary_search(int n1, int k){
    int l = 0, h = n1;
    int ans = 0;
    while(l<=h){
        int m = l + (h - l)/2;
        if(arr[n1+1] - arr[m]<k){
            ans = m;
            h = m-1;
        }
        else{
            l = m+1;
        }
    }
    return ans;
}
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    t = 1;
    while(t--){
        cin>>n;
        for(int i=0;i<n;i++)
            cin>>arr[i];
        ans[0] = 20;
        ans[1] = 20;
        pre[0] = 0;
        pre[1] = 20;
        pre[2] = 40;
        int i = 2;
        while(i<n){
            int k1 = binary_search(i-1, 90);
            int k2 = binary_search(i-1, 1440);
            //cout<<k1<<" "<<k2<<endl;
            ans[i] = 20;
            if(arr[i]-arr[k1]<90){
                ans[i] = min(ans[i], 50 - (pre[i] - pre[k1]));
            }
            if(arr[i] - arr[k2]<1440){
                ans[i] = min(ans[i], 120 - (pre[i] - pre[k2]));
            }
            pre[i+1] = pre[i] + ans[i];
            i++;
        }
        for(int i = 0;i<n;i++)
            cout<<ans[i]<<endl;
    }
    return 0;
}


//بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيمِ
// In the name of Allah

#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll llInf=1e18+1e17;
const int Inf=1e9+1e8, N=1e2+10, Mod=1e9+7;

int dp[N], t[N];

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n;
	cin>>n;
	dp[0]=0;
	for(int i=1; i<=n; i++){
		cin>>t[i];
		int ind2=upper_bound(t+1, t+i, t[i]-90)-t-1, ind3=upper_bound(t+1, t+i, t[i]-1440)-t-1;
		int val1=dp[i-1]+20;
		dp[i]=val1;
		int val2=dp[ind2]+50, val3=dp[ind3]+120;
		dp[i]=min({dp[i], val2, val3});
	}
	for(int i=1; i<=n; i++)
		cout<<dp[i]-dp[i-1]<<endl;
}


//بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيمِ
// In the name of Allah

#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll llInf=1e18+1e17;
const int Inf=1e9+1e8, N=1e5+10, Mod=1e9+7;

int dp[N], t[N];

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n;
	cin>>n;
	dp[0]=0;
	for(int i=1; i<=n; i++){
		cin>>t[i];
		int ind2=upper_bound(t+1, t+i, t[i]-90)-t-1, ind3=upper_bound(t+1, t+i, t[i]-1440)-t-1;
		int val1=dp[i-1]+20;
		dp[i]=val1;
		int val2=dp[ind2]+50, val3=dp[ind3]+120;
		dp[i]=min({dp[i], val2, val3});
	}
	for(int i=1; i<=n; i++)
		cout<<dp[i]-dp[i-1]<<endl;
}


#include<iostream>
#include<stdio.h>
#include<iomanip>
#include<vector>
#include<string>
#include<string.h>
#include<queue>
#include<math.h>
#include<utility>
#include<stack>
#include<unordered_map>
#include<map>
#include<set>
#include<unordered_set>
#include<algorithm>
#include<sstream>
#define ff first
#define ss second
#define mod 1000000007LL
#define PI 3.14159265
using namespace std;
typedef long long int ll;
ll mnm(ll a,ll b,ll c)
{
    if(a<=b&&a<=c)
        return a;
    else if(b<=a&&b<=c)
        return b;
    else
        return c;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        vector<ll>v(n);
        for(ll i=0;i<n;i++)
        {
            cin>>v[i];
        }
        vector<ll>mnc(n+1,0);
        mnc[1]=20;
        vector<ll>f(n,0);
        f[0]=20;ll tot=20;
        for(ll i=1;i<n;i++)
        {
            auto it1=upper_bound(v.begin(),v.end(),v[i]-90);
            ll i1=it1-v.begin();
            auto it2=upper_bound(v.begin(),v.end(),v[i]-1440);
            ll i2=it2-v.begin();
            ll m1=20+mnc[i];
            ll m2=50+mnc[i1];
            ll m3=120+mnc[i2];
            if(m1<=m2&&m1<=m3)
            {
                f[i]=m1-tot;
                tot=m1;
                mnc[i+1]=m1;
            }
            else if(m2<=m1&&m2<=m3)
            {
                f[i]=m2-tot;
                tot=m2;
                mnc[i+1]=m2;
            }
            else
            {
                f[i]=m3-tot;
                tot=m3;
                mnc[i+1]=m3;
            }
        }
        for(ll i=0;i<n;i++)
            cout<<f[i]<<"\n";
    }
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
    int n;cin>>n;
    ll arr[n];cin>>arr[0];
    ll sum[n];sum[0] = 20;
    for(int i=1;i<n;++i){
        cin>>arr[i];
        sum[i] = sum[i-1] + 20;
        int now1=-1,low=0,high=i-1;
        while(low<=high){
            int mid = low + (high-low)/2;
            if(arr[mid]+89>arr[i]){
                now1 = mid;
                high = mid-1;
            }
            else low=mid+1;
        }
        if(now1!=-1)sum[i]=min(sum[i],(!now1?0:sum[now1-1])+50);
        now1=-1,low=0,high=i-1;
        while(low<=high){
            int mid = low + (high-low)/2;
            if(arr[mid]+1439>arr[i]){
                now1 = mid;
                high = mid-1;
            }
            else low=mid+1;
        }
        if(now1!=-1)sum[i]=min(sum[i],(!now1?0:sum[now1-1])+120);
    }
    cout<<sum[0]<<" ";
    for(int i=1;i<n;++i){
        cout<<sum[i]-sum[i-1]<<" ";
    }
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
    int n;cin>>n;
    ll arr[n];cin>>arr[0];
    ll sum[n];sum[0] = 20;
    for(int i=1;i<n;++i){
        cin>>arr[i];
        sum[i] = sum[i-1] + 20;
        int now1=-1,low=0,high=i-1;
        while(low<=high){
            int mid = low + (high-low)/2;
            if(arr[mid]+89>=arr[i]){
                now1 = mid;
                high = mid-1;
            }
            else low=mid+1;
        }
        if(now1!=-1)sum[i]=min(sum[i],(!now1?0:sum[now1-1])+50);
        now1=-1,low=0,high=i-1;
        while(low<=high){
            int mid = low + (high-low)/2;
            if(arr[mid]+1439>=arr[i]){
                now1 = mid;
                high = mid-1;
            }
            else low=mid+1;
        }
        if(now1!=-1)sum[i]=min(sum[i],(!now1?0:sum[now1-1])+120);
    }
    cout<<sum[0]<<" ";
    for(int i=1;i<n;++i){
        cout<<sum[i]-sum[i-1]<<" ";
    }
}


#include<bits/stdc++.h>

using namespace std;

int main(){

    long long int t,i,j,k,p,q,r,n;

    t=1;

    while(t--){

        cin>>n;

        vector<long long int>v;

        long long int dp[n+3];

        dp[0]=0;

        for(i=1;i<=n;i++)
            dp[i]=10000000000000;

        for(i=1;i<=n;i++){
            cin>>j;
            v.push_back(j);

            dp[i]=min(dp[i],dp[i-1]+20);
            dp[i]=min(dp[i],dp[upper_bound(v.begin(),v.end(),j-90)-v.begin()]+50);
            dp[i]=min(dp[i],dp[upper_bound(v.begin(),v.end(),j-1440)-v.begin()]+120);
        }

        for(i=1;i<=n;i++)
            cout<<dp[i]-dp[i-1]<<"\n";
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const double PI = 3.141592653589793238463;
int main() {
#ifndef ONLINE_JUDGE
	freopen("in", "r", stdin);
	//freopen("out", "w", stdout);
#endif
    int n,x,y;
    cin>>n;
    vector<int>t(n);
    vector<long long>tot(n+1);
    t[0]=0;
    tot[0]=0ll;
    for (int i = 0; i <n; ++i) {
        cin>>t[i];
    }
    for (int i = 1; i <=n; ++i) {
        tot[i]=tot[i-1]+20;
        x=lower_bound(t.begin(),t.end(),t[i-1]-90+1)-t.begin();
        y=lower_bound(t.begin(),t.end(),t[i-1]-1440+1)-t.begin();
        tot[i]=min(tot[i],tot[x]+50);
        tot[i]=min(tot[i],tot[y]+120);
        cout<<tot[i]-tot[i-1]<<endl;
    }
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const double PI = 3.141592653589793238463;
int main() {
#ifndef ONLINE_JUDGE
	freopen("in", "r", stdin);
	//freopen("out", "w", stdout);
#endif
    int n,x,y;
    cin>>n;
    vector<int>t(n);
    vector<long long>tot(n+1);
    t[0]=0;
    tot[0]=0ll;
    for (int i = 0; i <n; ++i) {
        cin>>t[i];
    }
    for (int i = 1; i <=n; ++i) {
        tot[i]=tot[i-1]+20;
        x=upper_bound(t.begin(),t.end(),t[i-1]-90+1)-t.begin();
        y=upper_bound(t.begin(),t.end(),t[i-1]-1440+1)-t.begin();
        tot[i]=min(tot[i],tot[x]+50);
        tot[i]=min(tot[i],tot[y]+120);
        cout<<tot[i]-tot[i-1]<<endl;
    }
	return 0;
}


//Mr_rubick and batman
#include <bits/stdc++.h>

using namespace std;

int dp[100001] , t[100001];

int main()
{
	long long n;
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> t[i];
	for (int i = 1; i <= n; i++){
		dp[i] = dp[i - 1] + 20;
		int p = upper_bound (t , t + n + 1, t[i] - 90) - t;
		dp[i] = min (dp[i], dp[p - 1] + 50);
		int p2 = upper_bound (t , t + n + 1 , t[i] - 1440) - t;
		dp[i] = min (dp[i], dp[p2 - 1] + 120);
	}
	for (int i = 1; i <= n; i++){
		cout << dp[i] - dp[i - 1] << '\n';
	}
}


//Mr_rubick and batman
#include <bits/stdc++.h>

using namespace std;

int dp[100001] , t[100001];

int main()
{
	long long n;
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> t[i];
	for (int i = 1; i <= n; i++){
		dp[i] = dp[i - 1] + 20;
		int p = lower_bound (t , t + n + 1, t[i] - 90) - t;
		dp[i] = min(dp[i], dp[p-1]+50);
		int p2 = lower_bound (t , t + n +1 , t[i]-1440) - t;
		dp[i] = min(dp[i], dp[p2-1] + 120);
	}
	for (int i = 1; i <= n; i++){
		cout << dp[i] - dp[i - 1] << '\n';
	}
}


//Mr_rubick and batman
#include <bits/stdc++.h>

using namespace std;

int dp[100001] , t[100001];

int main()
{
	long long n;
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> t[i];
	for (int i = 1; i <= n; i++){
		dp[i] = dp[i - 1] + 20;
		int p = upper_bound (t , t + n + 1, t[i] - 90) - t;
		dp[i] = min(dp[i], dp[p-1]+50);
		int p2 = upper_bound (t , t + n +1 , t[i]-1440) - t;
		dp[i] = min(dp[i], dp[p2-1] + 120);
	}
	for (int i = 1; i <= n; i++){
		cout << dp[i] - dp[i - 1] << '\n';
	}
}


/*input
10
13
45
46
60
103
115
126
150
256
516

*/

//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define pb          push_back
#define pii         pair<ll int,ll int>
#define vpii        vector< pii >
#define vi          vector<ll int>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++)
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll N = 1e5+5;
ll dp[N];
ll ans[N];
vi a(N,0);

int solve()
{
	ll n;cin>>n;
	rep(i,1,n+1) cin>>a[i];
	ans[0]=dp[0]=0;

	rep(i,1,n+1)
	{
		ll tc = inf;
		if(i-1>=0) tc = min(dp[i-1]+20,tc);
		ll idx1 = (lbnd(a.begin()+1, a.begin()+i+1,(a[i]-90+1))-a.begin());idx1--;
		if(idx1>=0) tc=min(dp[idx1]+50,tc);
		ll idx2 = (lbnd(a.begin()+1, a.begin()+i+1,(a[i]-1440+1))-a.begin());idx2--;
		if(idx2>=0) tc=min(tc,dp[idx2]+120);
		ans[i]=tc-dp[i-1];
		dp[i]=tc;
	}

	rep(i,1,n+1) cout<<ans[i]<<"\n";

	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	// cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}


/*input
3
10
20
30
*/

//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define pb          push_back
#define pii         pair<ll int,ll int>
#define vpii        vector< pii >
#define vi          vector<ll int>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++)
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll N = 1e5+5;
ll dp[N];
ll ans[N];
vi a(N,0);

int solve()
{
	ll n;cin>>n;
	rep(i,1,n+1) cin>>a[i];
	ans[0]=dp[0]=0;

	rep(i,1,n+1)
	{
		ll tc = inf;
		if(i-1>=0) tc = min(dp[i-1]+20,tc);
		ll idx1 = (ubnd(a.begin()+1, a.begin()+i+1,(a[i]-90+1))-a.begin());idx1--;
		if(idx1>=0) tc=min(dp[idx1]+50,tc);
		ll idx2 = (ubnd(a.begin()+1, a.begin()+i+1,(a[i]-1440+1))-a.begin());idx2--;
		if(idx2>=0) tc=min(tc,dp[idx2]+120);
		ans[i]=tc-dp[i-1];
		dp[i]=tc;
	}

	rep(i,1,n+1) cout<<ans[i]<<"\n";

	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	// cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}


#include <bits/stdc++.h>

#define PI 3.14159265358979323846
#define EPS 1e-6
#define INF 1000000000

#define _ ios_base::sync_with_stdio(0), cin.tie(0), cin.tie(0), cout.tie(0), cout.precision(15);
#define FOR(i, a, b) for(int i=int(a); i<int(b); i++)
#define RFOR(i, a, b) for(int i=int(a)-1; i>=int(b); i--)
#define FORC(cont, it) for(typeof((cont).begin()) it = (cont).begin(); it != (cont).end(); it++)
#define RFORC(cont, it) for(typeof((cont).rbegin()) it = (cont).rbegin(); it != (cont).rend(); it++)
#define pb push_back

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;

#define MAXN 100005
#define MOD 1000000007

int n;
int arr[MAXN], dp[MAXN];

int binSearch(int x) {
    if (x < 0)     return 0;
    int ini = 0, fin = n, mid;

    while(ini + 1 < fin) {
        mid = (ini + fin) / 2;

        if (x > arr[mid])   ini = mid;
        else                fin = mid;
    }

    if (x >= arr[ini])     return fin;
    return ini;

}

void solve() {
    dp[0] = 0;

    FOR(i, 1, n+1) {
        dp[i] = min(
            dp[i-1] + 20,
            min(
                dp[binSearch(arr[i-1] - 90)] + 50,
                dp[binSearch(arr[i-1] - 1440)] + 120
            )
        );
    }
}

int main() { _
    while (cin >> n) {
        memset(arr, 0, sizeof(arr));
        memset(dp, 0, sizeof(dp));

        FOR(i, 0, n)    cin >> arr[i];

        solve();
        /*
        cout << endl << endl;
        FOR(i, 0, n+1) {
            cout << i << " " << dp[i] << endl;
        }
        cout << endl << endl;
        */
        FOR(i, 1, n+1) {
            cout << dp[i] - dp[i-1] << endl;
        }
    }

    return 0;
}


#include <bits/stdc++.h>

#define PI 3.14159265358979323846
#define EPS 1e-6
#define INF 1000000000

#define _ ios_base::sync_with_stdio(0), cin.tie(0), cin.tie(0), cout.tie(0), cout.precision(15);
#define FOR(i, a, b) for(int i=int(a); i<int(b); i++)
#define RFOR(i, a, b) for(int i=int(a)-1; i>=int(b); i--)
#define FORC(cont, it) for(typeof((cont).begin()) it = (cont).begin(); it != (cont).end(); it++)
#define RFORC(cont, it) for(typeof((cont).rbegin()) it = (cont).rbegin(); it != (cont).rend(); it++)
#define pb push_back

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;

#define MAXN 100005
#define MOD 1000000007

int n;
int arr[MAXN], dp[MAXN];

int binSearch(int x) {
    if (x < 0)     return 0;
    int ini = 0, fin = n, mid;

    while(ini + 1 < fin) {
        mid = (ini + fin) / 2;

        if (x >= arr[mid])   ini = mid;
        else                fin = mid;
    }

    if (x >= arr[ini])     return fin;
    return ini;

}

void solve() {
    dp[0] = 0;

    FOR(i, 1, n+1) {
        dp[i] = min(
            dp[i-1] + 20,
            min(
                dp[binSearch(arr[i-1] - 90)] + 50,
                dp[binSearch(arr[i-1] - 1440)] + 120
            )
        );
    }
}

int main() { _
    while (cin >> n) {
        memset(arr, 0, sizeof(arr));
        memset(dp, 0, sizeof(dp));

        FOR(i, 0, n)    cin >> arr[i];

        solve();
        /*
        cout << endl << endl;
        FOR(i, 0, n+1) {
            cout << i << " " << dp[i] << endl;
        }
        cout << endl << endl;
        */
        FOR(i, 1, n+1) {
            cout << dp[i] - dp[i-1] << endl;
        }
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int MAXN = (1e5)+2; // yes?
int n, t[MAXN], dp[MAXN];
int main() {
	scanf("%d",&n);
	for(int i = 0; i <= n; i++) t[i] = dp[i] = (1e9)+10;
	for(int i = 1; i <= n; i++) {
		scanf("%d",t+i);
		dp[i] = dp[i-1]+20;
		dp[i] = min(dp[upper_bound(t+1, t+n+1, t[i]-90)-t-1]+50, dp[i]);
		dp[i] = min(dp[upper_bound(t+1, t+n+1, t[i]-1440)-t-1]+120, dp[i]);
		printf("%d\n", dp[i]-dp[i-1]);
	}
}


#include <bits/stdc++.h>
using namespace std;

const int MAXN = (1e5)+1; // yes?
int n, dp[MAXN];
map<int,int> mp;
int main() {
	scanf("%d",&n);
	mp[0] = 0;
	for(int i = 1, t; i <= n; i++) {
		scanf("%d",&t);
		auto ith = mp.upper_bound(t-90), itd = mp.lower_bound(t-1440);
		int bef = INT_MAX;
		if(ith != mp.end()) bef = min(dp[ith->second-1]+50, bef);
		if(itd != mp.end()) bef = min(dp[itd->second-1]+120, bef);
		dp[i] = min(dp[i-1]+20, bef);
		mp[t] = i;
	}
	for(int i = 1; i <= n; i++) printf("%d\n", dp[i]-dp[i-1]);
}


#include <bits/stdc++.h>
using namespace std;

const int MAXN = (1e5)+2; // yes?
int n, t[MAXN], dp[MAXN];
int main() {
	scanf("%d",&n);
	for(int i = 0; i <= n; i++) t[i] = -1, dp[i] = (1e9)+10;
	for(int i = 1; i <= n; i++) {
		scanf("%d",t+i);
		dp[i] = dp[i-1]+20;
		dp[i] = min(dp[upper_bound(t+1, t+n+1, t[i]-90)-t-1]+50, dp[i]);
		dp[i] = min(dp[upper_bound(t+1, t+n+1, t[i]-1440)-t-1]+120, dp[i]);
		printf("%d\n", dp[i]-dp[i-1]);
	}
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;

 int val[100001];
  int t[100001];
int main() {
    int n;cin>>n;

    for(int i=1;i<=n;i++)
    {
       cin>>t[i];
       val[i]=val[i-1]+20;

val[i]=min(val[i],val[upper_bound(t+1,t+i+1,t[i]-90)-t-1]+50);
 val[i]=min(val[i],val[upper_bound(t+1,t+i+1,t[i]-1440)-t-1]+120);

cout<<val[i]-val[i-1]<<endl;

    }

}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
typedef pair<int, int> pii;
typedef vector<int> vi;

const int N = 200200;

int n;
int f[N], t[N];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    f[0] = 0;
    rep (i, 0, n) {
        cin >> t[i];
        f[i + 1] = f[i] + 20;
        f[i + 1] = min (f[i + 1], f[upper_bound(t, t + i, t[i] - 90) - t] + 50);
        f[i + 1] = min (f[i + 1], f[upper_bound(t, t + i, t[i] - 1440) - t] + 120);
    }
    rep (i, 0, n) cout << f[i + 1] - f[i] << '\n';
    return 0;
}


#include <iostream>
#include <cstdio>
#include <string.h>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <cmath>
#include <ctime>
#include <numeric>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector< vector<int> > vvi;
typedef vector<ll> vl;
typedef vector< vector<ll> > vvl;

#define forn(i, n) for (int i = 0; i < (int)(n); i++)
#define forv(i, v) forn(i, v.size())
#define all(v) v.begin(), v.end()
#define mp make_pair
#define pb push_back

const int INF = 1e9;

int price(int t1, int t2) {
    if (t2 - t1 < 90) return 50;
    if (t2 - t1 < 1440) return 120;
    return INF;
}

int main() {
#ifdef NEREVAR_PROJECT
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n; cin >> n;
    vi t(n);
    forn(i, n) scanf("%d", &t[i]);
    vi dp(n + 1, INF);
    dp[0] = 0;
    int charged = 0;
    for (int i = 1; i <= n; i++) {
        dp[i] = dp[i - 1] + 20;
        for (int j = i - 1; j > 0; j--) {
            int p = price(t[j - 1], t[i - 1]);
            if (p < INF) {
                dp[i] = min(dp[i], dp[j - 1] + p);
            }
        }
        int charge = dp[i] - charged;
        printf("%d\n", charge);
        charged += charge;
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <string.h>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <cmath>
#include <ctime>
#include <numeric>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector< vector<int> > vvi;
typedef vector<ll> vl;
typedef vector< vector<ll> > vvl;

#define forn(i, n) for (int i = 0; i < (int)(n); i++)
#define forv(i, v) forn(i, v.size())
#define all(v) v.begin(), v.end()
#define mp make_pair
#define pb push_back

const int INF = 1e9;

inline int price(int t1, int t2) {
    if (t2 - t1 < 90) return 50;
    if (t2 - t1 < 1440) return 120;
    return INF;
}

int main() {
#ifdef NEREVAR_PROJECT
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n; cin >> n;
    vi t(n);
    forn(i, n) scanf("%d", &t[i]);
    vi dp(n + 1, INF);
    dp[0] = 0;
    int charged = 0;
    for (int i = 1; i <= n; i++) {
        dp[i] = dp[i - 1] + 20;
        int p = 50;
        for (int j = i - 1; j > 0; j--) {
            if (t[i - 1] - t[j - 1] >= 90) p = 120;
            if (t[i - 1] - t[j - 1] >= 1440) break;
            if (p < INF) {
                dp[i] = min(dp[i], dp[j - 1] + p);
            }
        }
        int charge = dp[i] - charged;
        printf("%d\n", charge);
        charged += charge;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define sz(v)           ((int)((v).size()))
#define clr(v, d)       memset(v, d, sizeof(v))
#define rep(i, v)       for(int i=0; i<sz(v); ++i)
#define lp(i, n)        for(int i=0; i<(int)(n); ++i)
#define lpi(i, j, n)    for(int i=(j); i<(int)(n); ++i)
#define lpd(i, j, n)    for(int i=(j); i>=(int)(n); --i)
//#define INF             1000000000
//#define INF             100000000000000

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

void init(){
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}

const int N = 2e5+5;
int ans[N];
int sum[N];

int main()
{
	vi arr(N);
	int n;
	cin >> n;
	cin >> arr[0];
	sum[0] = ans[0] = 20;
	lpi(i, 1, n){
		int tmp;
		sum[i] = sum[i-1];
		cin >> arr[i];
		int idx_90 = upper_bound(arr.begin(), arr.begin()+i, arr[i]-90) - arr.begin();
		int idx_1440 = upper_bound(arr.begin(), arr.begin()+i, arr[i]-1440) - arr.begin();
		tmp = min(20, 50 - (sum[i-1] - sum[idx_90] + ans[idx_90]));
		ans[i] = min(tmp, 120 - (sum[i-1] - sum[idx_1440] + ans[idx_1440]));
		sum[i] += ans[i];
	}
	lp(i, n)
		cout << ans[i] << "\n";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
	long n;
	cin>>n;
	vector<ll> arr(n);
	ll x;
	for(long i=0; i< n; i++)
		scanf("%lld", &arr[i]);
	long it, sit, it1;
	sit = 0;
	ll a, b;
	a = 0;
	b = 0;
	vector<ll> dp(n);
	it = it1 = 0;
	for(long i = 0; i < n; i++,sit++) {
		b = a + 20;
		while(it != arr.size() && arr[it] <= arr[sit] - 90)
			it++;
		if(it == 0)
			b = min(b,(ll)50);
		else {
			it--;
			b = min(b,dp[it]+50);
		}
		while(it1 != arr.size() && arr[it1] <= arr[sit] - 1440)
			it1++;
		if(it1 == 0)
			b = min(b,(ll)120);
		else {
			it1--;
			b = min(b,dp[it1]+120);
		}
		// cout<<"it = "<<*it<<" it1 = "<<*it1<<" sit = "<<*sit<<endl;
		dp[sit] = b;
		printf("%lld\n",b-a);
		// cout<<a<<" b = "<<b<<endl;
		a = b;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
	long n;
	cin>>n;
	set<ll> arr;
	ll x;
	while(n--) {
		scanf("%lld", &x);
		arr.insert(x);
	}
	n = arr.size();
	set<ll>::iterator it, sit, it1;
	sit = arr.begin();
	ll a, b;
	a = 0;
	b = 0;
	vector<ll> dp(n);
	it = it1 = arr.begin();
	for(long i = 0; i < n; i++,sit++) {
		b = a + 20;
		while(*it < *sit - 90)
			it++;
		if(it == arr.begin())
			b = min(b,(ll)50);
		else {
			it--;
			b = min(b,dp[distance(arr.begin(),it)]+50);
		}
		while(*it1 < *sit - 1440)
			it1++;
		if(it1 == arr.begin())
			b = min(b,(ll)120);
		else {
			it1--;
			b = min(b,dp[distance(arr.begin(),it1)]+120);
		}
		dp[distance(arr.begin(),sit)] = b;
		printf("%lld\n",b-a);
		// cout<<a<<" b = "<<b<<endl;
		a = b;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
	long n;
	cin>>n;
	set<ll> arr;
	ll x;
	while(n--) {
		scanf("%lld", &x);
		arr.insert(x);
	}
	n = arr.size();
	set<ll>::iterator it, sit, it1;
	sit = arr.begin();
	ll a, b;
	a = 0;
	b = 0;
	vector<ll> dp(n);
	it = it1 = arr.begin();
	for(long i = 0; i < n; i++,sit++) {
		b = a + 20;
		while(it != arr.end() && *it <= *sit - 90)
			it++;
		if(it == arr.begin())
			b = min(b,(ll)50);
		else {
			it--;
			b = min(b,dp[distance(arr.begin(),it)]+50);
		}
		while(it1 != arr.end() && *it1 <= *sit - 1440)
			it1++;
		if(it1 == arr.begin())
			b = min(b,(ll)120);
		else {
			it1--;
			b = min(b,dp[distance(arr.begin(),it1)]+120);
		}
		// cout<<"it = "<<*it<<" it1 = "<<*it1<<" sit = "<<*sit<<endl;
		dp[distance(arr.begin(),sit)] = b;
		printf("%lld\n",b-a);
		// cout<<a<<" b = "<<b<<endl;
		a = b;
	}
	return 0;
}


#include<bits/stdc++.h>
#define ll  long long
#define pb push_back
#define mkp make_pair
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pi 3.14159265359
//PLEASE DON'T HACK I AM POOR :(
using namespace std;
int main()
{
   fastio
   ll n,m,w,i,j,k;
   cin>>n;
   ll tim[n+1];
   for(i=1;i<=n;i++)cin>>tim[i];
   ll dp[n+2]={0};
   vector<ll>v;vector<ll>::iterator it;
   ll ans[n+1]={0};
   // 20 50 120
   for(i=1;i<=n;i++)
   {
   	dp[i]=dp[i-1];
   	ll t=tim[i];
   	ll a1,a2;
   	it=lower_bound(v.begin(),v.end(),t-(ll)89);
   	if(it==v.end())a1=20;
   	else
   	{
   		ll ind=it-v.begin();
   		ll req=dp[i-1]-dp[ind];
   		a1=50-req;
	   }
   	it=lower_bound(v.begin(),v.end(),t-(ll)1439);
   	if(it==v.end())a2=20;
   	else
   	{
   		ll ind=it-v.begin();
   		ll req=dp[i-1]-dp[ind];
   		a2=120-req;
	   }
	   ans[i]=min(a1,a2);
	   ans[i]=min(ans[i],(ll)20);
	   dp[i]+=ans[i];
	   v.pb(tim[i]);

   }
   for(i=1;i<=n;i++)cout<<ans[i]<<"\n";
return 0;
}
// JAB BOLA GAREEB HU TO Q AAYA HAI


//By Vasu Agrawal
#include<iostream>
#include<bits/stdc++.h>
typedef long long int ll;
#define pb push_back
#define pob pop_back
#define mk make_pair
#define fr first
#define sc second
#define pu push
#define ins insert
#define mod 1000000007
#define mem(a,val) memset(a,val,sizeof(a))
#define V(a) vector<a>
#define pp pair<ll,ll>
#define lb(a,n) lower_bound(a.begin(),a.end(),n)-a.begin()
#define ub(a,n) upper_bound(a.begin(),a.end(),n)-a.begin()
#define F(i,n) for(ll i=0;i<n;i++)
#define in(a,n) F(i,n) cin>>a[i]
#define in1(a,n) f(i,n) cin>>a[i]
#define out1(a,n); f(i,n) cout<<a[i]<<" ";cout<<endl;
#define out(a,n); F(i,n) cout<<a[i]<<" ";cout<<endl;
#define f(i,n) for(ll i=1;i<=n;i++)
#define vasu2907 ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
bool isprime(ll n) //Time Complexity--->sqrt(n)
{   if (n <= 1)  return false; if (n <= 3)  return true;
  	if (n%2 == 0 || n%3 == 0) return false;
    for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0) return false;
    return true;
}
vector<ll> prime;
void sieve(ll n)
{	bool bakh[n+1];memset(bakh, true, sizeof(bakh));
    for (ll p=2; p*p<=n; p++)
    {	if (bakh[p] == true)
        {	for (ll i=p*p; i<=n; i += p)    bakh[i] = false; } }
  	for (ll p=2; p<=n; p++)    if (bakh[p])
	  	prime.pb(p);
}//Taken from https://www.geeksforgeeks.org/eulers-totient-function-for-all-numbers-smaller-than-or-equal-to-n/
ll eulertotient(ll z)   //Time--->n/logn
{	ll fac=z;
	for(ll i=0;prime[i]*prime[i]<=z;i++)
	{	if(z%prime[i]==0)
		{	fac-=(fac/prime[i]);	while(z%prime[i]==0)	z/=prime[i];	}
	}	if(z>1)	fac-=(fac/z);
	return fac;
}
//Taken from https://www.geeksforgeeks.org/modular-exponentiation-power-in-modular-arithmetic/
ll power(ll x,ll y,ll p)
{	ll res = 1; x = x % p;	while (y > 0)  {	if (y & 1)	res = (res*x) % p; 	y = y>>1;	x = (x*x) % p; }return res; }
//Taken from https://www.geeksforgeeks.org/euclidean-algorithms-basic-and-extended/
ll gcd(ll a,ll b)
{	if (a == 0)    return b; 	return gcd(b % a, a); }
ll lcm(ll a,ll b)
{	ll g=gcd(a,b); ll ans=(a*b)/g; return ans;	}
//Taken from https://www.geeksforgeeks.org/multiplicative-inverse-under-modulo-m/
ll modInverse(ll a, ll m)
{	ll hvf=gcd(a,m);	if(hvf==1)	return power(a,m-2,m);	return -1;}
void multiply(ll F[2][2], ll M[2][2])
{ ll x =  F[0][0]*M[0][0] + F[0][1]*M[1][0];  ll y =  F[0][0]*M[0][1] + F[0][1]*M[1][1];
  ll z =  F[1][0]*M[0][0] + F[1][1]*M[1][0];  ll w =  F[1][0]*M[0][1] + F[1][1]*M[1][1];
  F[0][0] = x;   F[0][1] = y;   F[1][0] = z;   F[1][1] = w;
}
void powermat(ll F[2][2], ll n)
{	if( n == 0 || n == 1)
    return; ll M[2][2] = {{1,1},{1,0}};   powermat(F, n/2);   multiply(F, F);   if (n%2 != 0)      multiply(F, M);
}
ll fib(ll n)
{ ll F[2][2] = {{1,1},{1,0}};
  if (n == 0) return 0; powermat(F, n-1);   return F[0][0];
}
V(ll) merge(V(ll) v1,V(ll) v2)
{	V(ll) temp;
	ll i=0,j=0;
	while(i<v1.size() && j<v2.size())
	{	if(v1[i]<v2[j])
			temp.pb(v1[i]),i++;
		else
			temp.pb(v2[j]),j++;
	}
	while(i<v1.size())
		temp.pb(v1[i]),i++;
	while(j<v2.size())
		temp.pb(v2[j]),j++;
	return temp;
}
//id=(id&(id+1))-1
//ll fetch(ll id)
//{
//}
//id=(id|(id+1))
//void update(ll id)
//{
//}

//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
// Code Starts Here
int main()
{	vasu2907;
	ll n;
	cin>>n;
	V(ll) ar(n,0),dp(n+1,0);
	in(ar,n);
	for(ll i=1;i<=n;i++)
	{	dp[i]=dp[i-1]+20;
		dp[i]=min(dp[i],50+dp[lb(ar,ar[i-1]-89)]);
		dp[i]=min(dp[i],120+dp[lb(ar,ar[i-1]-1439)]);
		cout<<dp[i]-dp[i-1]<<endl;
	}

}


//By Vasu Agrawal
#include<iostream>
#include<bits/stdc++.h>
typedef long long int ll;
#define pb push_back
#define pob pop_back
#define mk make_pair
#define fr first
#define sc second
#define pu push
#define ins insert
#define mod 1000000007
#define mem(a,val) memset(a,val,sizeof(a))
#define V(a) vector<a>
#define pp pair<ll,ll>
#define lb(a,n) lower_bound(a.begin(),a.end(),n)-a.begin()
#define ub(a,n) upper_bound(a.begin(),a.end(),n)-a.begin()
#define F(i,n) for(ll i=0;i<n;i++)
#define in(a,n) F(i,n) cin>>a[i]
#define in1(a,n) f(i,n) cin>>a[i]
#define out1(a,n); f(i,n) cout<<a[i]<<" ";cout<<endl;
#define out(a,n); F(i,n) cout<<a[i]<<" ";cout<<endl;
#define f(i,n) for(ll i=1;i<=n;i++)
#define vasu2907 ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
bool isprime(ll n) //Time Complexity--->sqrt(n)
{   if (n <= 1)  return false; if (n <= 3)  return true;
  	if (n%2 == 0 || n%3 == 0) return false;
    for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0) return false;
    return true;
}
vector<ll> prime;
void sieve(ll n)
{	bool bakh[n+1];memset(bakh, true, sizeof(bakh));
    for (ll p=2; p*p<=n; p++)
    {	if (bakh[p] == true)
        {	for (ll i=p*p; i<=n; i += p)    bakh[i] = false; } }
  	for (ll p=2; p<=n; p++)    if (bakh[p])
	  	prime.pb(p);
}//Taken from https://www.geeksforgeeks.org/eulers-totient-function-for-all-numbers-smaller-than-or-equal-to-n/
ll eulertotient(ll z)   //Time--->n/logn
{	ll fac=z;
	for(ll i=0;prime[i]*prime[i]<=z;i++)
	{	if(z%prime[i]==0)
		{	fac-=(fac/prime[i]);	while(z%prime[i]==0)	z/=prime[i];	}
	}	if(z>1)	fac-=(fac/z);
	return fac;
}
//Taken from https://www.geeksforgeeks.org/modular-exponentiation-power-in-modular-arithmetic/
ll power(ll x,ll y,ll p)
{	ll res = 1; x = x % p;	while (y > 0)  {	if (y & 1)	res = (res*x) % p; 	y = y>>1;	x = (x*x) % p; }return res; }
//Taken from https://www.geeksforgeeks.org/euclidean-algorithms-basic-and-extended/
ll gcd(ll a,ll b)
{	if (a == 0)    return b; 	return gcd(b % a, a); }
ll lcm(ll a,ll b)
{	ll g=gcd(a,b); ll ans=(a*b)/g; return ans;	}
//Taken from https://www.geeksforgeeks.org/multiplicative-inverse-under-modulo-m/
ll modInverse(ll a, ll m)
{	ll hvf=gcd(a,m);	if(hvf==1)	return power(a,m-2,m);	return -1;}
void multiply(ll F[2][2], ll M[2][2])
{ ll x =  F[0][0]*M[0][0] + F[0][1]*M[1][0];  ll y =  F[0][0]*M[0][1] + F[0][1]*M[1][1];
  ll z =  F[1][0]*M[0][0] + F[1][1]*M[1][0];  ll w =  F[1][0]*M[0][1] + F[1][1]*M[1][1];
  F[0][0] = x;   F[0][1] = y;   F[1][0] = z;   F[1][1] = w;
}
void powermat(ll F[2][2], ll n)
{	if( n == 0 || n == 1)
    return; ll M[2][2] = {{1,1},{1,0}};   powermat(F, n/2);   multiply(F, F);   if (n%2 != 0)      multiply(F, M);
}
ll fib(ll n)
{ ll F[2][2] = {{1,1},{1,0}};
  if (n == 0) return 0; powermat(F, n-1);   return F[0][0];
}
V(ll) merge(V(ll) v1,V(ll) v2)
{	V(ll) temp;
	ll i=0,j=0;
	while(i<v1.size() && j<v2.size())
	{	if(v1[i]<v2[j])
			temp.pb(v1[i]),i++;
		else
			temp.pb(v2[j]),j++;
	}
	while(i<v1.size())
		temp.pb(v1[i]),i++;
	while(j<v2.size())
		temp.pb(v2[j]),j++;
	return temp;
}
//id=(id&(id+1))-1
//ll fetch(ll id)
//{
//}
//id=(id|(id+1))
//void update(ll id)
//{
//}

//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
// Code Starts Here
int main()
{	vasu2907;
	ll n;
	cin>>n;
	V(ll) ar(n+1,0),dp(n+1,0);
	in(ar,n);
	for(ll i=1;i<=n;i++)
	{	dp[i]=dp[i-1]+20;
		dp[i]=min(dp[i],50+dp[lb(ar,ar[i-1]-89)]);
		dp[i]=min(dp[i],120+dp[lb(ar,ar[i-1]-1439)]);
		cout<<dp[i]-dp[i-1]<<endl;
	}

}


//By Vasu Agrawal
#include<iostream>
#include<bits/stdc++.h>
typedef long long int ll;
#define pb push_back
#define pob pop_back
#define mk make_pair
#define fr first
#define sc second
#define pu push
#define ins insert
#define mod 1000000007
#define mem(a,val) memset(a,val,sizeof(a))
#define V(a) vector<a>
#define pp pair<ll,ll>
#define lb(a,n) lower_bound(a.begin(),a.end(),n)-a.begin()
#define ub(a,n) upper_bound(a.begin(),a.end(),n)-a.begin()
#define F(i,n) for(ll i=0;i<n;i++)
#define in(a,n) F(i,n) cin>>a[i]
#define in1(a,n) f(i,n) cin>>a[i]
#define out1(a,n); f(i,n) cout<<a[i]<<" ";cout<<endl;
#define out(a,n); F(i,n) cout<<a[i]<<" ";cout<<endl;
#define f(i,n) for(ll i=1;i<=n;i++)
#define vasu2907 ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
bool isprime(ll n) //Time Complexity--->sqrt(n)
{   if (n <= 1)  return false; if (n <= 3)  return true;
  	if (n%2 == 0 || n%3 == 0) return false;
    for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0) return false;
    return true;
}
vector<ll> prime;
void sieve(ll n)
{	bool bakh[n+1];memset(bakh, true, sizeof(bakh));
    for (ll p=2; p*p<=n; p++)
    {	if (bakh[p] == true)
        {	for (ll i=p*p; i<=n; i += p)    bakh[i] = false; } }
  	for (ll p=2; p<=n; p++)    if (bakh[p])
	  	prime.pb(p);
}//Taken from https://www.geeksforgeeks.org/eulers-totient-function-for-all-numbers-smaller-than-or-equal-to-n/
ll eulertotient(ll z)   //Time--->n/logn
{	ll fac=z;
	for(ll i=0;prime[i]*prime[i]<=z;i++)
	{	if(z%prime[i]==0)
		{	fac-=(fac/prime[i]);	while(z%prime[i]==0)	z/=prime[i];	}
	}	if(z>1)	fac-=(fac/z);
	return fac;
}
//Taken from https://www.geeksforgeeks.org/modular-exponentiation-power-in-modular-arithmetic/
ll power(ll x,ll y,ll p)
{	ll res = 1; x = x % p;	while (y > 0)  {	if (y & 1)	res = (res*x) % p; 	y = y>>1;	x = (x*x) % p; }return res; }
//Taken from https://www.geeksforgeeks.org/euclidean-algorithms-basic-and-extended/
ll gcd(ll a,ll b)
{	if (a == 0)    return b; 	return gcd(b % a, a); }
ll lcm(ll a,ll b)
{	ll g=gcd(a,b); ll ans=(a*b)/g; return ans;	}
//Taken from https://www.geeksforgeeks.org/multiplicative-inverse-under-modulo-m/
ll modInverse(ll a, ll m)
{	ll hvf=gcd(a,m);	if(hvf==1)	return power(a,m-2,m);	return -1;}
void multiply(ll F[2][2], ll M[2][2])
{ ll x =  F[0][0]*M[0][0] + F[0][1]*M[1][0];  ll y =  F[0][0]*M[0][1] + F[0][1]*M[1][1];
  ll z =  F[1][0]*M[0][0] + F[1][1]*M[1][0];  ll w =  F[1][0]*M[0][1] + F[1][1]*M[1][1];
  F[0][0] = x;   F[0][1] = y;   F[1][0] = z;   F[1][1] = w;
}
void powermat(ll F[2][2], ll n)
{	if( n == 0 || n == 1)
    return; ll M[2][2] = {{1,1},{1,0}};   powermat(F, n/2);   multiply(F, F);   if (n%2 != 0)      multiply(F, M);
}
ll fib(ll n)
{ ll F[2][2] = {{1,1},{1,0}};
  if (n == 0) return 0; powermat(F, n-1);   return F[0][0];
}
V(ll) merge(V(ll) v1,V(ll) v2)
{	V(ll) temp;
	ll i=0,j=0;
	while(i<v1.size() && j<v2.size())
	{	if(v1[i]<v2[j])
			temp.pb(v1[i]),i++;
		else
			temp.pb(v2[j]),j++;
	}
	while(i<v1.size())
		temp.pb(v1[i]),i++;
	while(j<v2.size())
		temp.pb(v2[j]),j++;
	return temp;
}
//id=(id&(id+1))-1
//ll fetch(ll id)
//{
//}
//id=(id|(id+1))
//void update(ll id)
//{
//}

//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
// Code Starts Here
int main()
{	vasu2907;
	ll n;
	cin>>n;
	V(ll) ar(n+1,0),dp(n+1,0);
	in(ar,n);
	for(ll i=1;i<=n;i++)
	{	dp[i]=dp[i-1]+20;
		dp[i]=min(dp[i],50+dp[lb(ar,ar[i]-89)]);
		dp[i]=min(dp[i],120+dp[lb(ar,ar[i]-1439)]);
		cout<<dp[i]-dp[i-1]<<endl;
	}

}


#include <bits\stdc++.h>
using namespace std;

int n,t[100010];
long long mincost[100010];
int tem;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);

    cin >> n;
    for(int i = 1; i <= n; i++)cin>>t[i];

    mincost[1] = 20;
    for(int i = 2; i <= n; i++){
        mincost[i]=mincost[i-1]+20;
        tem = lower_bound(t,t+n,t[i]-89)-t;
        if(tem!=n+1)mincost[i]=min(mincost[i],mincost[tem-1]+50);
        tem = lower_bound(t,t+n,t[i]-1439)-t;
        if(tem!=n+1)mincost[i]=min(mincost[i],mincost[tem-1]+120);
    }
    for(int i = 1; i <= n; i++){
       cout<< (mincost[i] - mincost[i-1]) << endl;

    }

}


#include <bits\stdc++.h>
using namespace std;

int n,t[100010];
long long paid = 0, mincost[100010];
int tem;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);

    cin >> n;
    for(int i = 1; i <= n; i++)cin>>t[i];

    mincost[1] = 20;
    for(int i = 2; i <= n; i++){
        mincost[i]=mincost[i-1]+20;
        tem = lower_bound(t,t+n,t[i]-89)-t;
        if(tem!=n+1)mincost[i]=min(mincost[i],mincost[tem-1]+50);
        tem = lower_bound(t,t+n,t[i]-1439)-t;
        if(tem!=n+1)mincost[i]=min(mincost[i],mincost[tem-1]+120);
    }
    for(int i = 1; i <= n; i++){
       cout<< (mincost[i] - paid) << endl;
        paid += mincost[i] - paid;

    }

}


#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <stdio.h>
#include <bits/stdc++.h>

#define uint unsigned int
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
using namespace std;
const int mn=10e5;
int dp[mn],a[mn],pref[mn],n;
main(){
	cin>>n;
	rep(i,1,n+1){
		cin>>a[i];

		int c=a[i]-1444;
		int l=1,r=i-1,lp=i;

		while(l<=r){
			int mid=(r+l)/2;
			if(a[mid]>=c)
				r=mid-1,lp=mid;
			else if(a[mid]<c)
				l=mid+1;}

		c=a[i]-90;
		l=1,r=i-1;int lp2=i;

		while(l<=r){

			int mid=(r+l)/2;
			if(a[mid]>=c)
				r=mid-1,lp2=mid;
			else if(a[mid]<c)
				l=mid+1;}

		//10 13 45 46 60 103 115 126 150 256 516
		//20 20 10 0 20 0 0 20 20 10

		pref[i]=min(pref[i-1]+20,min(pref[lp-1]+120,pref[lp2-1]+50));
		//cout<<pref[i]<<" ";
		cout<<pref[i]-pref[i-1]<<endl;
	}
}


#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <stdio.h>
#include <bits/stdc++.h>

#define uint unsigned int
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
using namespace std;
const int mn=10e5;
int dp[mn],a[mn],pref[mn],n;
main(){
	cin>>n;
	rep(i,1,n+1){
		cin>>a[i];

		int c=a[i]-1439;
		int l=1,r=i-1,lp=i;

		while(l<=r){
			int mid=(r+l)/2;
			if(a[mid]>=c)
				r=mid-1,lp=mid;
			else if(a[mid]<c)
				l=mid+1;}

		c=a[i]-89;
		l=1,r=i-1;int lp2=i;

		while(l<=r){

			int mid=(r+l)/2;
			if(a[mid]>=c)
				r=mid-1,lp2=mid;
			else if(a[mid]<c)
				l=mid+1;}

		//10 13 45 46 60 103 115 126 150 256 516
		//20 20 10 0 20 0 0 20 20 10

		pref[i]=min(pref[i-1]+20,min(pref[lp-1]+120,pref[lp2-1]+50));
		//cout<<pref[i]<<" ";
		cout<<pref[i]-pref[i-1]<<endl;
	}
}


#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <stdio.h>
#include <bits/stdc++.h>

#define uint unsigned int
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
using namespace std;
const int mn=10e5;
int dp[mn],a[mn],pref[mn],n;
main(){
	cin>>n;
	rep(i,1,n+1){
		cin>>a[i];

		int c=a[i]-1439;
		int l=1,r=i-1,lp=i-1;

		while(l<=r){
			int mid=(r+l)/2;
			if(a[mid]>=c)
				r=mid-1,lp=mid;
			else if(a[mid]<c)
				l=mid+1;}

		c=a[i]-90;
		l=1,r=i-1;int lp2=i-1;

		while(l<=r){

			int mid=(r+l)/2;
			if(a[mid]>=c)
				r=mid-1,lp2=mid;
			else if(a[mid]<c)
				l=mid+1;}

		//10 13 45 46 60 103 115 126 150 256 516
		//20 20 10 0 20 0 0 20 20 10

		pref[i]=min(pref[i-1]+20,min(pref[lp-1]+120,pref[lp2-1]+50));
		//cout<<pref[i]<<" ";
		cout<<pref[i]-pref[i-1]<<endl;
	}
}


#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <stdio.h>
#include <bits/stdc++.h>

#define uint unsigned int
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
using namespace std;
const int mn=10e5;
int dp[mn],a[mn],pref[mn],n;
main(){
	cin>>n;
	rep(i,1,n+1){
		cin>>a[i];

		int c=a[i]-1443;
		int l=1,r=i-1,lp=i;

		while(l<=r){
			int mid=(r+l)/2;
			if(a[mid]>=c)
				r=mid-1,lp=mid;
			else if(a[mid]<c)
				l=mid+1;}

		c=a[i]-89;
		l=1,r=i-1;int lp2=i;

		while(l<=r){

			int mid=(r+l)/2;
			if(a[mid]>=c)
				r=mid-1,lp2=mid;
			else if(a[mid]<c)
				l=mid+1;}

		//10 13 45 46 60 103 115 126 150 256 516
		//20 20 10 0 20 0 0 20 20 10

		pref[i]=min(pref[i-1]+20,min(pref[lp-1]+120,pref[lp2-1]+50));
		//cout<<pref[i]<<" ";
		cout<<pref[i]-pref[i-1]<<endl;
	}
}


#include <iostream>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define pb push_back

using namespace std;
typedef long long LL;
const int N=100000+5;
//dp[i]=max
//dp[i-1]+20
//dp[j]+50
//dp[j]+120
int n,a[N],dp[N];
int main() {

#ifdef LOCAL_DEFINE
//	freopen("solve.in", "rt", stdin);
#endif
	int x,y,z,j;
	cin>>n;
	for1(i,n){
		cin>>a[i];
	}
	for(int i=1;i<=n;i++){
		x=dp[i-1]+20;
		j=lower_bound(a+1,a+1+n,a[i]-90)-a-1;
		y=dp[j]+50;
		j=lower_bound(a+1,a+1+n,a[i]-1440)-a-1;
		z=dp[j]+120;
		dp[i]=min(min(x,y),z);
	}
	for(int i=1;i<=n;i++){
		cout<<dp[i]-dp[i-1]<<endl;
	}

#ifdef LOCAL_DEFINE
	cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


#include <iostream>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define pb push_back

using namespace std;
typedef long long LL;
const int N=100000+5;
//dp[i]=max
//dp[i-1]+20
//dp[j]+50
//dp[j]+120
int n,a[N],dp[N];
int main() {

#ifdef LOCAL_DEFINE
//	freopen("solve.in", "rt", stdin);
#endif
	int x,y,z,j;
	cin>>n;
	for1(i,n){
		cin>>a[i];
	}
	for(int i=1;i<=n;i++){
		x=dp[i-1]+20;
		j=upper_bound(a+1,a+1+n,a[i]-90)-a-1;
		y=dp[j]+50;
		j=upper_bound(a+1,a+1+n,a[i]-1440)-a-1;
		z=dp[j]+120;
		dp[i]=min(min(x,y),z);
	}
	for(int i=1;i<=n;i++){
		cout<<dp[i]-dp[i-1]<<endl;
	}

#ifdef LOCAL_DEFINE
	cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


#include <bits/stdc++.h>
using namespace std ;
typedef long long int ll ;

int main(){
	ll n; cin >> n;
	vector<ll> times(n + 1), prefix_time(n + 1);
	times[0] = 0;prefix_time[0] = 0;
	for(int i=1;i<=n;i++)cin >> prefix_time[i];

	vector<ll> dp(n + 1);
	dp[0] = 0;
	for(int i=1;i<=n;i++){
		ll ans1 = dp[i - 1] + 20;
		ll ans2 = 1e18, ans3=1e18;
		ll index2, index3;

		if(prefix_time[i] - prefix_time[1] < 90)ans2 = 50;
		else{
			index2 = lower_bound(prefix_time.begin(), prefix_time.end(), prefix_time[i] - 90) - prefix_time.begin();
			if(prefix_time[index2] == prefix_time[i] - 90 + 1){
				ans2 = dp[index2] + 50;
			}
			else if(prefix_time[index2] > prefix_time[i] - 90 + 1){
				ans2 = dp[index2 - 1] + 50;
			}
		}

		if(prefix_time[i] - prefix_time[1] < 1440)ans3 = 120;
		else{
			index3 = lower_bound(prefix_time.begin(), prefix_time.end(), prefix_time[i] - 1440) - prefix_time.begin();
			if(prefix_time[index2] == prefix_time[i] - 1440 + 1){
				ans3 = dp[index3] + 120;
			}
			else if(prefix_time[index3] > prefix_time[i] - 1440 + 1){
				ans3 = dp[index3 - 1] + 120;
			}
		}
		dp[i] = min(min(ans2,ans3), ans1);
	}
	for(int i=1;i<=n;i++){
		cout << (dp[i] - dp[i-1]) << " ";
	}
	cout << endl;
}


#include <bits/stdc++.h>
using namespace std ;
typedef long long int ll ;

int main(){
	ll n; cin >> n;
	vector<ll> times(n + 1), prefix_time(n + 1);
	times[0] = 0;prefix_time[0] = 0;
	for(int i=1;i<=n;i++)cin >> prefix_time[i];

	vector<ll> dp(n + 1);
	dp[0] = 0;
	for(int i=1;i<=n;i++){
		ll ans1 = dp[i - 1] + 20;
		ll ans2 = 1e18, ans3=1e18;
		ll index2, index3;

		if(prefix_time[i] - prefix_time[1] < 90)ans2 = 50;
		else{
			index2 = lower_bound(prefix_time.begin(), prefix_time.end(), prefix_time[i] - 90 ) - prefix_time.begin();
			if(prefix_time[index2] == prefix_time[i] - 90){
				ans2 = dp[index2] + 50;
			}
			else if(prefix_time[index2] > prefix_time[i] - 90){
				ans2 = dp[index2 - 1] + 50;
			}
		}

		if(prefix_time[i] - prefix_time[1] < 1440)ans3 = 120;
		else{
			index3 = lower_bound(prefix_time.begin(), prefix_time.end(), prefix_time[i] - 1440) - prefix_time.begin();
			if(prefix_time[index3] == prefix_time[i] - 1440){
				ans3 = dp[index3] + 120;
			}
			else if(prefix_time[index3] > prefix_time[i] - 1440){
				ans3 = dp[index3 - 1] + 120;
			}
		}
		dp[i] = min(min(ans2,ans3), ans1);
	}
	for(int i=1;i<=n;i++){
		cout << (dp[i] - dp[i-1]) << " ";
	}
	cout << endl;
}


#include <bits/stdc++.h>
using namespace std ;
typedef long long int ll ;

int main(){
	ll n; cin >> n;
	vector<ll> times(n + 1), prefix_time(n + 1);
	times[0] = 0;prefix_time[0] = 0;
	for(int i=1;i<=n;i++)cin >> prefix_time[i];

	vector<ll> dp(n + 1);
	dp[0] = 0;
	for(int i=1;i<=n;i++){
		ll ans1 = dp[i - 1] + 20;
		ll ans2 = 1e18, ans3=1e18;
		ll index2, index3;

		if(prefix_time[i] - prefix_time[1] < 90)ans2 = 50;
		else{
			index2 = lower_bound(prefix_time.begin(), prefix_time.end(), prefix_time[i] - 90 ) - prefix_time.begin();
			if(prefix_time[index2] == prefix_time[i] - 90){
				ans2 = dp[index2] + 50;
			}
			else if(prefix_time[index2] > prefix_time[i] - 90 + 1){
				ans2 = dp[index2 - 1] + 50;
			}
		}

		if(prefix_time[i] - prefix_time[1] < 1440)ans3 = 120;
		else{
			index3 = lower_bound(prefix_time.begin(), prefix_time.end(), prefix_time[i] - 1440) - prefix_time.begin();
			if(prefix_time[index2] == prefix_time[i] - 1440){
				ans3 = dp[index3] + 120;
			}
			else if(prefix_time[index3] > prefix_time[i] - 1440 + 1){
				ans3 = dp[index3 - 1] + 120;
			}
		}
		dp[i] = min(min(ans2,ans3), ans1);
	}
	for(int i=1;i<=n;i++){
		cout << (dp[i] - dp[i-1]) << " ";
	}
	cout << endl;
}


#include <bits/stdc++.h>
using namespace std ;
typedef long long int ll ;

int main(){
	ll n; cin >> n;
	vector<ll> times(n + 1), prefix_time(n + 1);
	times[0] = 0;prefix_time[0] = 0;
	for(int i=1;i<=n;i++)cin >> prefix_time[i];

	vector<ll> dp(n + 1);
	dp[0] = 0;
	for(int i=1;i<=n;i++){
		ll ans1 = dp[i - 1] + 20;
		ll ans2 = 1e18, ans3=1e18;
		ll index2, index3;

		if(prefix_time[i] - prefix_time[1] < 90 + 1)ans2 = 50;
		else{
			index2 = lower_bound(prefix_time.begin(), prefix_time.end(), prefix_time[i] - 90 - 1) - prefix_time.begin();
			if(prefix_time[index2] == prefix_time[i] - 90 - 1){
				ans2 = dp[index2] + 50;
			}
			else if(prefix_time[index2] > prefix_time[i] - 90 - 1){
				ans2 = dp[index2 - 1] + 50;
			}
		}

		if(prefix_time[i] - prefix_time[1] < 1440 + 1)ans3 = 120;
		else{
			index3 = lower_bound(prefix_time.begin(), prefix_time.end(), prefix_time[i] - 1440 - 1) - prefix_time.begin();
			if(prefix_time[index3] == prefix_time[i] - 1440 - 1){
				ans3 = dp[index3] + 120;
			}
			else if(prefix_time[index3] > prefix_time[i] - 1440 - 1){
				ans3 = dp[index3 - 1] + 120;
			}
		}
		dp[i] = min(min(ans2,ans3), ans1);
	}
	for(int i=1;i<=n;i++){
		cout << (dp[i] - dp[i-1]) << " ";
	}
	cout << endl;
}


#include <bits/stdc++.h>
using namespace std ;
typedef long long int ll ;

int main(){
	ll n; cin >> n;
	vector<ll> times(n + 1), prefix_time(n + 1);
	times[0] = 0;prefix_time[0] = 0;
	for(int i=1;i<=n;i++)cin >> prefix_time[i];

	vector<ll> dp(n + 1);
	dp[0] = 0;
	for(int i=1;i<=n;i++){
		ll ans1 = dp[i - 1] + 20;
		ll ans2 = 1e18, ans3=1e18;
		ll index2, index3;

		if(prefix_time[i] - prefix_time[1] < 90)ans2 = 50;
		else{
			index2 = upper_bound(prefix_time.begin(), prefix_time.end(), prefix_time[i] - 90 ) - prefix_time.begin();
			ans2 = dp[index2 - 1] + 50;
		}

		if(prefix_time[i] - prefix_time[1] < 1440)ans3 = 120;
		else{
			index3 = upper_bound(prefix_time.begin(), prefix_time.end(), prefix_time[i] - 1440) - prefix_time.begin();
			ans3 = dp[index3 - 1] + 120;
		}
		dp[i] = min(min(ans2,ans3), ans1);
	}
	for(int i=1;i<=n;i++){
		cout << (dp[i] - dp[i-1]) << " ";
	}
	cout << endl;
}


#include <bits/stdc++.h>
using namespace std ;
typedef long long int ll ;

int main(){
	ll n; cin >> n;
	vector<ll> times(n + 1), prefix_time(n + 1);
	times[0] = 0;prefix_time[0] = 0;
	for(int i=1;i<=n;i++)cin >> prefix_time[i];

	vector<ll> dp(n + 1);
	dp[0] = 0;
	for(int i=1;i<=n;i++){
		ll ans1 = dp[i - 1] + 20;
		ll ans2 = 1e18, ans3=1e18;
		ll index2, index3;

		if(prefix_time[i] - prefix_time[1] < 90)ans2 = 50;
		else{
			index2 = lower_bound(prefix_time.begin(), prefix_time.end(), prefix_time[i] - 90 ) - prefix_time.begin();
			if(prefix_time[index2] == prefix_time[i] - 90){
				ans2 = dp[index2] + 50;
			}
			else if(prefix_time[index2] > prefix_time[i] - 90){
				ans2 = dp[index2 - 1] + 50;
			}
		}

		if(prefix_time[i] - prefix_time[1] < 1440)ans3 = 120;
		else{
			index3 = lower_bound(prefix_time.begin(), prefix_time.end(), prefix_time[i] - 1440) - prefix_time.begin();
			if(prefix_time[index2] == prefix_time[i] - 1440){
				ans3 = dp[index3] + 120;
			}
			else if(prefix_time[index3] > prefix_time[i] - 1440){
				ans3 = dp[index3 - 1] + 120;
			}
		}
		dp[i] = min(min(ans2,ans3), ans1);
	}
	for(int i=1;i<=n;i++){
		cout << (dp[i] - dp[i-1]) << " ";
	}
	cout << endl;
}


#include <bits/stdc++.h>
using namespace std ;
typedef long long int ll ;

int main(){
	ll n; cin >> n;
	vector<ll> times(n + 1), prefix_time(n + 1);
	times[0] = 0;prefix_time[0] = 0;
	for(int i=1;i<=n;i++)cin >> prefix_time[i];

	vector<ll> dp(n + 1);
	dp[0] = 0;
	for(int i=1;i<=n;i++){
		ll ans1 = dp[i - 1] + 20;
		ll ans2 = 1e18, ans3=1e18;
		ll index2, index3;

		if(prefix_time[i] <= 90)ans2 = 50;
		else{
			index2 = lower_bound(prefix_time.begin(), prefix_time.end(), prefix_time[i] - 90) - prefix_time.begin();
			if(prefix_time[index2] == prefix_time[i] - 90 + 1){
				ans2 = dp[index2] + 50;
			}
			else if(prefix_time[index2] > prefix_time[i] - 90 + 1){
				ans2 = dp[index2 - 1] + 50;
			}
		}

		if(prefix_time[i] <= 1440)ans3 = 120;
		else{
			index3 = lower_bound(prefix_time.begin(), prefix_time.end(), prefix_time[i] - 1440) - prefix_time.begin();
			if(prefix_time[index2] == prefix_time[i] - 1440 + 1){
				ans3 = dp[index3] + 120;
			}
			else if(prefix_time[index3] > prefix_time[i] - 1440 + 1){
				ans3 = dp[index3 - 1] + 120;
			}
		}
		dp[i] = min(min(ans2,ans3), ans1);
	}
	for(int i=1;i<=n;i++){
		cout << (dp[i] - dp[i-1]) << " ";
	}
	cout << endl;
}


#include "bits/stdc++.h"
using namespace std;
const int MAX = 1e5+10;
int arr[MAX];
int dp[MAX];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin >> arr[i];
		dp[i]=dp[i-1]+20;
		int idx1 = lower_bound(arr+1,arr+1+i,arr[i]-90)-arr-1;
		//cout << idx1 << "\n";
		dp[i]=min(dp[i],dp[idx1]+50);
		int idx2 = lower_bound(arr+1,arr+1+i,arr[i]-1440)-arr-1;
		dp[i]=min(dp[i],dp[idx2]+120);
		cout << max(0,dp[i]-dp[i-1]) << "\n";
	}
}


#include "bits/stdc++.h"
using namespace std;
const int MAX = 1e5+10;
int arr[MAX];
int dp[MAX];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin >> arr[i];
		dp[i]=dp[i-1]+20;
		int idx1 = upper_bound(arr+1,arr+1+i,arr[i]-90)-arr-1;
		//cout << idx1 << "\n";
		dp[i]=min(dp[i],dp[idx1]+50);
		int idx2 = upper_bound(arr+1,arr+1+i,arr[i]-1440)-arr-1;
		dp[i]=min(dp[i],dp[idx2]+120);
		cout << max(0,dp[i]-dp[i-1]) << "\n";
	}
}


/*****************
 * Adam Pawloski *
 *****************/

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef set<int> SI;
typedef pair<int, int> PII;
typedef vector<pair<int, int> > VPII;

const int INF = 1000000001;
const int EPS = 1e-9;
const int MOD = 1000000007;

//813437586

#define ALL(c) (c).begin(), (c).end()
#define SIZE(x) ((int)(x).size())
#define VAR(v, n) auto v = (n)
#define FOREACH(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)

#define MP make_pair
#define PB push_back
#define ST first
#define ND second

/*************************** END OF TEMPLATE ***************************/

const int maxn = 100005;

int a[maxn];
int dp[maxn];

int main()
{
	ios_base::sync_with_stdio(false);

	int n;
	cin >> n;
	for(int i = 1; i <= n; i++)
		cin >> a[i];

	dp[0] = 20;

	for(int i = 1; i < n; i++)
	{
		dp[i] = dp[i-1] + 20;

		int b = 0;
		int e = i-1;
		while(b <= e)
		{
			int m = b + (e-b)/2;
			if(a[m] + 89 >= a[i])
				e = m-1;
			else
				b = m+1;
		}
		if(b == 0)
			dp[i] = min(dp[i], 50);
		else
			dp[i] = min(dp[i], dp[b-1] + 50);

		b = 0;
		e = i-1;
		while(b <= e)
		{
			int m = b + (e-b)/2;
			if(a[m] + 1439 >= a[i])
				e = m-1;
			else
				b = m+1;
		}
		if(b == 0)
			dp[i] = min(dp[i], 120);
		else
			dp[i] = min(dp[i], dp[b-1] + 120);
	}
	cout << 20 << '\n';
	for(int i = 1; i < n; i++)
		cout << dp[i] - dp[i-1] << '\n';

}


/*****************
 * Adam Pawloski *
 *****************/

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef set<int> SI;
typedef pair<int, int> PII;
typedef vector<pair<int, int> > VPII;

const int INF = 1000000001;
const int EPS = 1e-9;
const int MOD = 1000000007;

//813437586

#define ALL(c) (c).begin(), (c).end()
#define SIZE(x) ((int)(x).size())
#define VAR(v, n) auto v = (n)
#define FOREACH(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)

#define MP make_pair
#define PB push_back
#define ST first
#define ND second

/*************************** END OF TEMPLATE ***************************/

const int maxn = 100005;

int a[maxn];
int dp[maxn];

int main()
{
	ios_base::sync_with_stdio(false);

	int n;
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> a[i];

	dp[0] = 20;

	for(int i = 1; i < n; i++)
	{
		dp[i] = dp[i-1] + 20;

		int b = 0;
		int e = i-1;
		while(b <= e)
		{
			int m = b + (e-b)/2;
			if(a[m] + 89 >= a[i])
				e = m-1;
			else
				b = m+1;
		}
		if(b == 0)
			dp[i] = min(dp[i], 50);
		else
			dp[i] = min(dp[i], dp[b-1] + 50);

		b = 0;
		e = i-1;
		while(b <= e)
		{
			int m = b + (e-b)/2;
			if(a[m] + 1439 >= a[i])
				e = m-1;
			else
				b = m+1;
		}
		if(b == 0)
			dp[i] = min(dp[i], 120);
		else
			dp[i] = min(dp[i], dp[b-1] + 120);
	}
	cout << 20 << '\n';
	for(int i = 1; i < n; i++)
		cout << dp[i] - dp[i-1] << '\n';

}


#include <bits/stdc++.h>

using namespace std;

#define ll				long long
#define dd				double
#define X				first
#define Y				second
#define mp				make_pair
#define pb				push_back
#define forn( i, n ) 	for( ll i = 0; i < (ll) (n); i ++ )
#define endl			'\n'

ll t[111111];
ll dp[111111][3];

int main( void ) {
	cin.tie( 0 ); cin.sync_with_stdio( 0 );
	ll n;
	cin >> n;
	ll b = 0;
	forn( i, n ) {
		cin >> t[i];
		ll j = i - 1;
		ll res1 = 1e9;
		forn( k, 3 ) {
			if( j < 0 )
				continue;
			res1 = min( res1, dp[j][k] );
		}
		while( j >= 0 && t[i] - t[j] < 90 )
			j --;
		ll res2 = 1e9;
		forn( k, 3 ) {
			if( j < 0 )
				continue;
			res2 = min( res2, dp[j][k] );
		}
		while( j >= 0 && t[i] - t[j] < 1440 )
			j --;
		ll res3 = 1e9;
		forn( k, 3 ) {
			if( j < 0 )
				continue;
			res3 = min( res3, dp[j][k] );
		}
		if( res1 == 1000000000 )
			res1 = 0;
		if( res2 == 1000000000 )
			res2 = 0;
		if( res3 == 1000000000 )
			res3 = 0;
		dp[i][0] = res1 + 20;
		dp[i][1] = res2 + 50;
		dp[i][2] = res3 + 120;

		ll a = 1e9;
		forn( j, 3 ) {
			a = min( a, dp[i][j] );
		}
		cout << a - b << endl;
		b = a;
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll				long long
#define dd				double
#define X				first
#define Y				second
#define mp				make_pair
#define pb				push_back
#define forn( i, n ) 	for( ll i = 0; i < (ll) (n); i ++ )
#define endl			'\n'

ll t[111111];
ll dp[111111][4];

int main( void ) {
	cin.tie( 0 ); cin.sync_with_stdio( 0 );
	ll n;
	cin >> n;
	ll b = 0;
	forn( i, n ) {
		cin >> t[i];
		dp[i][0] = 1e9;
		ll res = 1e9;
		ll j = i - 1;
		if( j >= 0 ) {
			res = min( res, dp[j][1] );
			res = min( res, dp[j][0] );
		}
		while( j >= 0 && t[i] - t[j] < 90 ) {
			dp[i][0] = min( dp[i][0], dp[j][2] );
			dp[i][0] = min( dp[i][0], dp[j][3] );
			j --;
		}
		if( j >= 0 )
			res = min( res, dp[j][2] );
		while( j >= 0 && t[i] - t[j] < 1440 ) {
			dp[i][0] = min( dp[i][0], dp[j][3] );
			j --;
		}
		if( j >= 0 )
			res = min( res, dp[j][3] );
		if( res == 1000000000 )
			res = 0;
		dp[i][1] = res + 20;
		dp[i][2] = res + 50;
		dp[i][3] = res + 120;
		ll a = 1e9;
		forn( j, 4 ) {
			a = min( a, dp[i][j] );
		}
		cout << a - b << endl;
		b = a;
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll				long long
#define dd				double
#define X				first
#define Y				second
#define mp				make_pair
#define pb				push_back
#define forn( i, n ) 	for( ll i = 0; i < (ll) (n); i ++ )
#define endl			'\n'

ll t[111111];
ll dp[111111][4];

int main( void ) {
	cin.tie( 0 ); cin.sync_with_stdio( 0 );
	ll n;
	cin >> n;
	ll b = 0;
	forn( i, n ) {
		cin >> t[i];
		dp[i][0] = 1e9;
		ll res = 1e9;
		ll j = i - 1;
		if( j >= 0 )
			res = min( res, dp[j][1] );
		while( j >= 0 && t[i] - t[j] < 90 ) {
			dp[i][0] = min( dp[i][0], dp[j][2] );
			dp[i][0] = min( dp[i][0], dp[j][3] );
			j --;
		}
		if( j >= 0 )
			res = min( res, dp[j][2] );
		while( j >= 0 && t[i] - t[j] < 1440 ) {
			dp[i][0] = min( dp[i][0], dp[j][3] );
			j --;
		}
		if( j >= 0 )
			res = min( res, dp[j][3] );
		if( res == 1000000000 )
			res = 0;
		dp[i][1] = res + 20;
		dp[i][2] = res + 50;
		dp[i][3] = res + 120;
		ll a = 1e9;
		forn( j, 4 ) {
			a = min( a, dp[i][j] );
		}
		cout << a - b << endl;
		b = a;
	}
	return 0;
}


#include <iostream>
#include <set>
#include <iterator>
#include <bitset>
#include <bits/stdc++.h>
using namespace std;
typedef  long long int ll;
ll mod=1000000007;

int main() {
    int t=1;
    //cin>>t;
    while(t--)
    {   int n;
        cin>>n;
        ll a[n+1];vector<ll> p;

    std::vector<ll>::iterator itr,itr1;

        for(int i=1;i<=n;i++){cin>>a[i];p.push_back(a[i]);}
        ll dp[n+1];
        dp[0]=0;
        for(int i=1;i<=n;i++)
        {   auto itr=std::lower_bound(p.begin(),p.end(),a[i]+1-90);
            auto itr1=std::lower_bound(p.begin(),p.end(),a[i]+1-1440);
            dp[i]=min(dp[i-1]+20,min(dp[itr-p.begin()]+50,dp[itr1-p.begin()]+120));

        }

        for(int i=1;i<=n;i++)

           cout<<dp[i]-dp[i-1]<<endl;

    }
	return 0;
}


/* DISJOINT SET UNION 1-D*/
 #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
typedef pair<ll,ll> key;
typedef pair<char,char> sub;
typedef vector<ll> vi;
#define p pop_back
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define M pow(10,10)
bool prime[10000000];
set<ll>::iterator it;
int main()
{
    map<ll,ll> price;
    ll n;
    cin>>n;
    ll t;
    set<ll> s;
    s.insert(-100000);
    price[-100000]=0;
    s.insert(-1);
    price[-1]=0;
    price[0]=0;
    s.insert(0);
    ll ans=20;
    cin>>t;
    price[t]=20;
    s.insert(t);
    cout<<ans<<endl;
    ll sum=20;
    for(ll i=2;i<=n;i++)
    {
        cin>>t;
        s.insert(t);
        it=s.lower_bound(t);
        it--;
        price[t]=price[*it]+20;
        ans=20;
        it=s.upper_bound(t-90);
        it--;
        if(price[t]>price[*it]+50)
        {
            price[t]=price[*it]+50;
            ans=price[t]-sum;
        }
        it=s.upper_bound(t-1440);
        it--;
        if(price[t]>price[*it]+120)
        {
            price[t]=price[*it]+120;
            ans=price[t]-sum;
        }
       cout<<ans<<endl;
        sum=price[t];
    }
}


/* DISJOINT SET UNION 1-D*/
 #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
typedef pair<ll,ll> key;
typedef pair<char,char> sub;
typedef vector<ll> vi;
#define p pop_back
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define M pow(10,10)
bool prime[10000000];
set<ll>::iterator it;
int main()
{
    map<ll,ll> price;
    ll n;
    cin>>n;
    ll t;
    set<ll> s;
    cin>>t;
    price[t]=20;
    s.insert(t);
    s.insert(-100000);
    price[-100000]=0;
    price[0]=0;
    s.insert(0);
    ll ans=20;
    cout<<ans<<endl;
    ll sum=20;
    for(ll i=2;i<=n;i++)
    {
        cin>>t;
        s.insert(t);
        it=s.lower_bound(t);
        it--;
        price[t]=price[*it]+20;
        ans=20;
        it=s.upper_bound(t-90);
        it--;
        if(price[t]>price[*it]+50)
        {
            price[t]=price[*it]+50;
            ans=price[t]-sum;
        }
        it=s.upper_bound(t-1440);
        it--;
        if(price[t]>price[*it]+120)
        {
            price[t]=price[*it]+120;
            ans=price[t]-sum;
        }
       cout<<ans<<endl;
        sum=price[t];
    }
}


/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5+5;

int n;
int t[N];
int ans[N];

int get(int i , int x){
	int l = i;
	int r = n;
	while(l < r){
		int mid = (l + r + 1) >> 1;
		if(t[mid] - t[i] <= x)
			l = mid;
		else
			r = mid - 1;
	}
	return l;
}

int main(){
	scanf("%d" , &n);
	for(int i = 1; i <= n; i++){
		scanf("%d" , &t[i]);
	}
	for(int i = 1; i <= n; i++){
		int t1 = get(i , 1440);
		int t2 = get(i , 90);
		if( 120 < (t1 - t2) * 20 + 50 ){
			ans[i] = 120;
			i = t1;
		} else if(50 < (t2 - i + 1) * 20 ) {
			ans[i] = 50;
			i = t2;
		} else {
			ans[i] = 20;
		}
	}
	for(int i = 1; i <= n; i++){
		printf("%d\n" , ans[i]);
	}
}


/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5+5;

int n;
int t[N];
int dp[N];

int main(){
	scanf("%d" , &n);
	for(int i = 1; i <= n; i++){
		scanf("%d" , &t[i]);
		dp[i] = dp[i - 1] + 20;
		int idx = lower_bound(t + 1 , t + i + 1 , t[i] - 90 + 1) - t;
		dp[i] = min(dp[i] , dp[idx - 1] + 50);
		idx = lower_bound(t + 1 , t + i + 1 , t[i] - 1440 + 1) - t;
		dp[i] = min(dp[i] , dp[idx - 1] + 120);
		printf("%d\n" , dp[i] - dp[i - 1]);
	}
}


#include <bits/stdc++.h>
using namespace std;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

//using namespace __gnu_pbds;

	//typedef tree<
			//int,
			//null_type,
			//less<int>,
			//rb_tree_tag,
			//tree_order_statistics_node_update>
	//ordered_set;

//#define REP(i,m) for(int i=0;i<(m);++i)
//struct dsu{
	//static const int MAXN=105;
	//int par[MAXN];
	//int size[MAXN];
	//void init(){
		//memset(par,-1,sizeof(par));
		//REP(i,MAXN) size[i]=1;
	//}
	//int root(int a){
		//if(par[a]==-1) return a;
		//return par[a]=root(par[a]);
	//}
	//void unite(int a,int b){
		//a=root(a);b=root(b);
		//if(a==b) return;
		//if(size[a]<size[b]) swap(a,b);

		//par[b]=a;
		//size[a]+=size[b];
	//}
	//bool same(int a,int b){
		//return root(a)==root(b);
	//}
//};
#define what_is(x) cerr << #x << " is " << x << endl;
#define eb emplace_back
#define ll long long

int main(){
	ios::sync_with_stdio(false);cin.tie(0);
	ll n;cin>>n;
	vector <ll> vec(n+1);
	for(int i=1;i<=n;i++)cin>>vec[i];
	vector <ll> val(n+1);
	vec[0]=INT_MIN;
	for(int i=1;i<=n;i++){
		ll pos1=lower_bound(vec.begin(),vec.begin()+i+1,vec[i]-89)-vec.begin();
		pos1--;
		ll pos2=lower_bound(vec.begin(),vec.begin()+i+1,vec[i]-1439)-vec.begin();
		pos2--;
		val[i]=min(val[i-1]+20,min(val[pos1]+50,val[pos2]+120));
		cout<<val[i]-val[i-1]<<endl;
	}
	return 0;

}


#include <iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdio.h>
#include<set>
#include<map>
#include<array>
using namespace std;
#define mod 1000000007
#define test int t;scanf("%d", &t);while(t--)
#define pb push_back
#define all(x) x.begin(),x.end()
#define mpr make_pair
#define ll long long int
#define ull unsigned long long int
#define db double
#define vi vector<int>
#define vii vector<pair<int,int> >
#define pii pair<int,int>
#define vl vector<ll>
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define ub upper_bound
#define lb lower_bound

#define sc(x) scanf("%d",&x)
#define sc2(x,y) scanf("%d%d",&x,&y)
#define sc3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define sc4(w,x,y,z) scanf("%d%d%d%d",&w,&x,&y,&z)

#define scll(x) scanf("%lld",&x)
#define scll2(x,y) scanf("%lld%lld",&x,&y)
#define scll3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z)
#define scll4(w,x,y,z) scanf("%lld%lld%lld%lld",&w,&x,&y,&z)

#define scdb(x) scanf("%lf",&x)
#define scdb2(x,y) scanf("%lf%lf",&x,&y)
#define scdb3(x,y,z) scanf("%lf%lf%lf",&x,&y,&z)
#define scdb4(w,x,y,z) scanf("%lf%lf%lf%lf",&w,&x,&y,&z)

#define scs(s) scanf("%s", s)

#define pr(x) printf("%d\n",x)
#define pr2(x,y) printf("%d %d\n",x,y)
#define pr3(x,y,z) printf("%d %d %d\n",x,y,z)
#define pr4(w,x,y,z) printf("%d %d %d %d\n",w,x,y,z)

#define prll(x) printf("%lld\n",x)
#define prll2(x,y) printf("%lld %lld\n",x,y)
#define prll3(x,y,z) printf("%lld %lld %lld\n",x,y,z)
#define prll4(w,x,y,z) printf("%lld %lld %lld %lld\n",w,x,y,z)

#define prdb(x) printf("%lf\n",x)
#define prdb2(x,y) printf("%lf %lf\n",x,y)
#define prdb3(x,y,z) printf("%lf %lf %lf\n",x,y,z)
#define prdb4(w,x,y,z) printf("%lf %lf %lf %lf\n",w,x,y,z)

#define prs(s) printf("%s\n", s)
#define prn() printf("\n")
#define prvec(v) for(int i=0;i<v.size();i++) cout << v[i] << " "
#define prpair(p) cout<<p.first<<" "<<p.second<<endl
#define F first
#define S second

#define maxr 100005
int dp[maxr], t[maxr];
int main()
{
  int n;
  cin>>n;
  int ind1 = 0, ind2 = 0;
  for(int i=1;i<=n;i++)
  {
    cin>>t[i];
    while(t[i]-t[ind1]>=90)ind1++;
    while(t[i]-t[ind1]>=1440)ind2++;
    dp[i] = min(dp[i-1]+20,min(dp[max(0,ind1-1)]+50,dp[max(0,ind2-1)]+120));
  }
  for(int i=1;i<=n;i++)cout<<dp[i]-dp[i-1]<<endl;
  return 0;
}


#include <iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdio.h>
#include<set>
#include<map>
#include<array>
using namespace std;
#define mod 1000000007
#define test int t;scanf("%d", &t);while(t--)
#define pb push_back
#define all(x) x.begin(),x.end()
#define mpr make_pair
#define ll long long int
#define ull unsigned long long int
#define db double
#define vi vector<int>
#define vii vector<pair<int,int> >
#define pii pair<int,int>
#define vl vector<ll>
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define ub upper_bound
#define lb lower_bound

#define sc(x) scanf("%d",&x)
#define sc2(x,y) scanf("%d%d",&x,&y)
#define sc3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define sc4(w,x,y,z) scanf("%d%d%d%d",&w,&x,&y,&z)

#define scll(x) scanf("%lld",&x)
#define scll2(x,y) scanf("%lld%lld",&x,&y)
#define scll3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z)
#define scll4(w,x,y,z) scanf("%lld%lld%lld%lld",&w,&x,&y,&z)

#define scdb(x) scanf("%lf",&x)
#define scdb2(x,y) scanf("%lf%lf",&x,&y)
#define scdb3(x,y,z) scanf("%lf%lf%lf",&x,&y,&z)
#define scdb4(w,x,y,z) scanf("%lf%lf%lf%lf",&w,&x,&y,&z)

#define scs(s) scanf("%s", s)

#define pr(x) printf("%d\n",x)
#define pr2(x,y) printf("%d %d\n",x,y)
#define pr3(x,y,z) printf("%d %d %d\n",x,y,z)
#define pr4(w,x,y,z) printf("%d %d %d %d\n",w,x,y,z)

#define prll(x) printf("%lld\n",x)
#define prll2(x,y) printf("%lld %lld\n",x,y)
#define prll3(x,y,z) printf("%lld %lld %lld\n",x,y,z)
#define prll4(w,x,y,z) printf("%lld %lld %lld %lld\n",w,x,y,z)

#define prdb(x) printf("%lf\n",x)
#define prdb2(x,y) printf("%lf %lf\n",x,y)
#define prdb3(x,y,z) printf("%lf %lf %lf\n",x,y,z)
#define prdb4(w,x,y,z) printf("%lf %lf %lf %lf\n",w,x,y,z)

#define prs(s) printf("%s\n", s)
#define prn() printf("\n")
#define prvec(v) for(int i=0;i<v.size();i++) cout << v[i] << " "
#define prpair(p) cout<<p.first<<" "<<p.second<<endl
#define F first
#define S second

#define maxr 100005
int dp[maxr], t[maxr];
int main()
{
  int n;
  cin>>n;
  int ind1 = 1, ind2 = 1;
  for(int i=1;i<=n;i++)
  {
    cin>>t[i];
    while(t[i]-t[ind1]>=90)ind1++;
    while(t[i]-t[ind2]>=1440)ind2++;
    dp[i] = min(dp[i-1]+20,min(dp[ind1-1]+50,dp[ind2-1]+120));
  }
  for(int i=1;i<=n;i++)cout<<dp[i]-dp[i-1]<<endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int N=1e5+10;
int n,t[N],f[N];

int main(){
    scanf("%d",&n);
    memset(f,0x3f,sizeof(f));
    f[0]=0;
    for(int i=1;i<=n;i++){
        scanf("%d",&t[i]);
        f[i]=min(f[i],f[i-1]+20);
        int j=lower_bound(t+1,t+n+1,t[i]-89)-t;
        f[i]=min(f[i],f[j-1]+50);
        j=lower_bound(t+1,t+n+1,t[i]-1439)-t;
        f[i]=min(f[i],f[j-1]+120);
        printf("%d\n",f[i]-f[i-1]);
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int N=1e5+10;
int n,t[N],f[N];

int main(){
    scanf("%d",&n);
    memset(f,0x3f,sizeof(f));
    f[0]=0;
    for(int i=1;i<=n;i++){
        scanf("%d",&t[i]);
    }
    for(int i=1;i<=n;i++){
        f[i]=min(f[i],f[i-1]+20);
        int j=lower_bound(t+1,t+n+1,t[i]-89)-t;
        f[i]=min(f[i],f[j-1]+50);
        j=lower_bound(t+1,t+n+1,t[i]-1439)-t;
        f[i]=min(f[i],f[j-1]+120);
        printf("%d\n",f[i]-f[i-1]);
    }
    return 0;
}


// exp worth blood
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define fs first
#define sc second
#define mp make_pair
using namespace std;
const ll maxn = 3e5 + 9;
const ll mod = 1e9 + 7;
typedef pair<ll,ll> LL;

ll n,a[maxn],i,dp[maxn],now[maxn],cur;
ll x,y,ans;
ll min3(ll x,ll y,ll z){
    return min(x,min(y,z));
}
ll bs(ll v){
    ll l,m,h;
    l = 1; h = n;
    while(l <= h){
        m = (l + h)/2;
        if (a[m] < v) l = m + 1;
        else h = m - 1;
    }
    return l;
}
int main() {
    ios_base::sync_with_stdio(false);
   	cin.tie(0); cout.tie(0);
	freopen("test.INP", "r", stdin);
    cin>>n;
    for (i=1;i<=n;i++) cin>>a[i];
    now[1] = dp[1] = 20;
    for (i=2;i<=n;i++){
       x = bs(a[i] - 90 + 1) - 1;
       y = bs(a[i] - 1440 + 1) - 1;
       ans = min3(now[x] + 50,now[y] + 120,now[i-1] + 20);
       dp[i] = max(0ll,ans - now[i-1]);
       now[i] = now[i-1] + dp[i];
    }
    for(i=1;i<=n;i++) cout<<dp[i]<<"\n";
}


// exp worth blood
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define fs first
#define sc second
#define mp make_pair
using namespace std;
const ll maxn = 3e5 + 9;
const ll mod = 1e9 + 7;
typedef pair<ll,ll> LL;

ll n,a[maxn],i,dp[maxn],now[maxn],cur;
ll x,y,ans;
ll min3(ll x,ll y,ll z){
    return min(x,min(y,z));
}
ll bs(ll v){
    ll l,m,h;
    l = 1; h = n;
    while(l <= h){
        m = (l + h)/2;
        if (a[m] < v) l = m + 1;
        else h = m - 1;
    }
    return l;
}
int main() {
    ios_base::sync_with_stdio(false);
   	cin.tie(0); cout.tie(0);
	//freopen("test.INP", "r", stdin);
    cin>>n;
    for (i=1;i<=n;i++) cin>>a[i];
    now[1] = dp[1] = 20;
    for (i=2;i<=n;i++){
       x = bs(a[i] - 90) - 1;
       y = bs(a[i] - 1440) - 1;
       ans = min3(now[x] + 50,now[y] + 120,now[i-1] + 20);
       dp[i] = max(0ll,ans - now[i-1]);
       now[i] = now[i-1] + dp[i];
    }
    for(i=1;i<=n;i++) cout<<dp[i]<<"\n";
}


// exp worth blood
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define fs first
#define sc second
#define mp make_pair
using namespace std;
const ll maxn = 3e5 + 9;
const ll mod = 1e9 + 7;
typedef pair<ll,ll> LL;

ll n,a[maxn],i,dp[maxn],now[maxn],cur;
ll x,y,ans;
ll min3(ll x,ll y,ll z){
    return min(x,min(y,z));
}
ll bs(ll v){
    ll l,m,h;
    l = 1; h = n;
    while(l <= h){
        m = (l + h)/2;
        if (a[m] < v) l = m + 1;
        else h = m - 1;
    }
    return l;
}
int main() {
    ios_base::sync_with_stdio(false);
   	cin.tie(0); cout.tie(0);
	//freopen("test.INP", "r", stdin);
    cin>>n;
    for (i=1;i<=n;i++) cin>>a[i];
    now[1] = dp[1] = 20;
    for (i=2;i<=n;i++){
       x = bs(a[i] - 90 + 1) - 1;
       y = bs(a[i] - 1440 + 1) - 1;
       ans = min3(now[x] + 50,now[y] + 120,now[i-1] + 20);
       dp[i] = max(0ll,ans - now[i-1]);
       now[i] = now[i-1] + dp[i];
    }
    for(i=1;i<=n;i++) cout<<dp[i]<<"\n";
}


#include<bits/stdc++.h>
using namespace std;

int main ()
{
    const int R = 90,D=1440,S=20,B=50,L=120;
    long n;
    scanf("%ld", &n);
    std::vector<long> t(n + 1, 0), me(n + 1, 0);

    long tb(0), td(0);
    for (int p = 1; p <= n; ++p)
    {
        scanf("%ld", &t[p]);

        while(t[tb + 1] + R <= t[p])
        {
            ++tb;
        }
        while(t[td + 1] + D <= t[p])
        {
            ++td;
        }
        me[p] = ((me[p - 1] + S) < (me[tb] + B)) ? (me[p - 1] + S) : (me[tb] + B);
        me[p] = (me[p] < (me[td] + L)) ? me[p] : (me[td] + L);
        printf("%ld\n", me[p] - me[p - 1]);
    }

    return 0;
}