/*
# Include <iostream>
// # Include <fstream>
// # Include <time. h>
// # Include <cstdio>
Using namespace STD;
Int A [5010], B [5010], C [5000];
Int main ()
{
// Ifstream CIN ("AA. In ");
Int J = 0, K = 0;
Int N;
Cin> N;
Int I, Maxi = 0;
Int sum = 0; // ± í» ý ë °í
For (I = 0; I <n; I ++)
{
Cin> A [I];
}
B [J] = A [0];
For (I = 0; I <n; I ++)
{
If (B [J] <A [I])
{
J ++;
B [J] = A [I];
Maxi = I;
}
}
// Cout <Maxi <Endl;
// Cout <A [Maxi] <Endl;
// ========================================
For (I = 0; I <= J; I ++)
{
Cout <B [I] <"";
}
Cout <Endl;
// ========================================
// Çóç° ° ë ¶ µ µä» ý ë
// Cout <Endl;
J = 0;
K = 0;
While (j <Maxi)
{
If (B [k]> = A [J])
{
Int TMP = B [k]-A [J];
Sum + = TMP;
J ++;
}
Else
{
K ++;
}
}
// Cout <"S" <sum <Endl;
C [0] = A [n-1];
K = 0;
For (I = n-1; I> = J; I --)
{
If (C [k] <A [I])
{
K ++;
C [k] = A [I];
}
}
For (I = 0; I <= K; I ++)
{
Cout <C [I] <"";
}
J = n-1;
K = 0;
While (j> Maxi)
{
If (C [k]> = A [J])
{
Int TMP = C [k]-A [J];
Sum + = TMP;
J --;
}
Else
{
K ++;
}
}
Cout <sum <Endl;
Return 0;
}
*/
/*
# Include <iostream>
# Include <fstream>
# Include <string. h>
# Include <time. h>
# Define n 1010
# Define M 110
Using namespace STD;
Typedef struct
{
Int data [N];
Char C [N];
} Col_cost;
Int stable (string S, int N)
{
For (INT)
}
Int hospool (string a, string B)
{
}
Int main ()
{
Ifstream CIN ("AA. In ");
Int N;
Cin> N;
Col_cost S;
For (INT I = 0; I <n; I ++)
{
Cin> S. Data [I];
}
For (INT I = 0; I <n; I ++)
{
Cin> S. C [I];
}
Char CS [m];
Int m;
Cin> m;
Int flag = 0;
For (INT I = 0; I <m; I ++)
{
Cin> CS [I];
}
Int res;
For (RES = n-1; Res> = 0; res --)
{
Int J;
For (j = m-1; j> = 0; j --)
{
If (S. C [res] = cs [J])
{
Res --;
}
Else break;
}
If (j <0) {flag = 1; break ;}
}
If (! Flag) Return-1;
Else
{
Int sum = 0;
Res + = m;
For (INT I = 0; I <m; I ++)
{
Sum + = S. Data [res];
Res --;
}
Cout <sum <Endl;
Cout. Precision (8 );
Cout <fixed <(double) Clock ()/clocks_per_sec <Endl;
Return 0;
}
}
*/