Vasya plays the sleuth with his friends. The rules of the game are as follows: those who play for the first time, that is Vasya is the sleuth, he should investigate a "crime" and find out what is happening. He can ask any questions whatsoever that can be answered with "Yes" or "No". All the rest agree beforehand to answer the questions like that: if the question’s last letter is a vowel, they answer "Yes" and if the last letter is a consonant, they answer "No". Of course, the sleuth knows nothing about it and his task is to understand that.Unfortunately, Vasya is not very smart. After 5 hours of endless stupid questions everybody except Vasya got bored. That’s why Vasya’s friends ask you to write a program that would give answers instead of them.The English alphabet vowels are: A, E, I, O, U, YThe English alphabet consonants are: B, C, D, F, G, H, J, K, L, M, N, P, Q, R, S, T, V, W, X, Z

The single line contains a question represented by a non-empty line consisting of large and small Latin letters, spaces and a question mark. The line length does not exceed 100. It is guaranteed that the question mark occurs exactly once in the line — as the last symbol and that the line contains at least one letter.

Print answer for the question in a single line: YES if the answer is "Yes", NO if the answer is "No". Remember that in the reply to the question the last letter, not the last character counts. I. e. the spaces and the question mark do not count as letters.

Is   it an apple  and a  banana   simultaneouSLY?

uses sysutils;
var s:string;
i:integer;
begin
readln(s);
s:=lowercase(s);i:=length(s);
while not (s[i] in ['a'..'z']) do dec(i);
if s[i] in ['a','e','i','o','u','y'] then writeln('YES') else writeln('NO');
end.

program Project2;
Var s:string;
c:Char;
begin
//  Assign(input,'input.txt');
//  Assign(output,'output.txt');
  Readln(s);
  while (s[Length(s)]='?')or(s[Length(s)]=' ') do
  Delete(s,Length(s),1);
  c:=s[Length(s)];
  if (c='A')or(c='U')or(c='E')or(c='O')or(c='I')or(c='Y')or(c='a')or(c='u')or(c='e')or(c='o')or(c='i')or(c='y')
  then Writeln('YES')
  else Writeln('NO');
end.

program Syshik;

{$APPTYPE CONSOLE}

var
s : string;
i : byte;
fl : boolean;
sym : set of char;
begin
readln (s);
sym:=[];
sym:=sym+['i']+['o']+['a']+['e']+['u']+['y']+['I']+['O']+['A']+['E']+['U']+['Y'];
fl:=true;
i:=length (s);
while fl and (i>=1) do
begin
if ((ord(s [i])>=ord('a')) and (ord(s [i])<=ord('z'))) or ((ord(s [i])>=ord('A')) and (ord(s [i])<=ord('Z'))) then
begin
if s [i] in sym then write ('YES')
else write ('NO');
fl:=false;
end;
dec (i);
end;
end.

var
  m: integer;
  s, l: string;

begin
  read(s);
  m := length(s);
  repeat
    m := m - 1;
  until s[m] <> ' ';

  l := 'euoiayEYUIOA';
  if pos(s[m], l) <> 0 then
    writeln('YES');

  l := 'bcdfghjklmnpqrrstvwxzBCDFGHJKLMNPQRSTVWXZ';
  if pos(s[m], l) <> 0 then
    writeln('NO')

end.

program aaaa1;

{$APPTYPE CONSOLE} {$O-}

uses
  SysUtils;

var
    i: longint;
    s, ss, c: string;
begin
 { reset(input, 'input.txt');
  rewrite(output, 'output.txt');}
  readln(s);
    ss:='AEOUYIaeouyi';
    c:='qwrtpsdfghjklzxcvbnmQWRTPSDFGHJKLZXCVBNM';
  for i:=length(s) downto 1 do begin
    if pos(s[i], ss)<>0 then begin write('YES'); halt end;
    if pos(s[i], c)<>0 then begin write('NO'); halt end;
  end;

end.

var s:string;
x:Integer;
begin
  //reset(input,'input.txt');
  //rewrite(output,'output.txt');
  Readln(s);
  x:=Length(s);
  while not (s[x] in ['a'..'z','A'..'Z'])do
  begin
    Dec(x);
  end;
  if s[x]in['A', 'E', 'I', 'O', 'U', 'Y','a','e','i','o','u','y']
  then Writeln('YES')
  else Writeln('NO');
end.

const
  fin = 'GOSLEEP.INP'; fout = 'GOSLEEP.OUT';
var
  s: string;
  i: longint;

 begin
   //assign(input, fin); reset(input);
   //assign(output, fout); rewrite(output);
   readln(s);
   for i:= length(s) downto 1 do
          if (s[i] <> ' ') and (s[i] <> '?') then
                case s[i] of
                        'A', 'a', 'E', 'e', 'I', 'i', 'O', 'o', 'U', 'u', 'Y', 'y':
                                begin
                                  writeln('YES');
                                  halt;
                                end;
                else
                        begin
                          writeln('NO');
                          halt;
                        end;
                end;
   //close(input); close(output);
 end.

var
    a:string;
    f:array[1..6]of char=('A','E','I','O','U','Y');
    n,i,l:longint;
begin
    readln(a);
    l:=length(A);
    for i:=1 to l do
        a[i]:=upcase(a[i]);
    while (a[l]='?')or(a[l]='.')or(a[l]=' ')or(a[l]='!') do dec(l);
    for i:=6 downto 1 do
        if a[l]=f[i] then n:=1;
    if n=1 then writeln('YES')
    else writeln('NO');
end. //

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;
  var s,a,b:string;
  i,j:integer;
begin
 b:='BCDFGHJKLMNPQRSTVWXZbcdfghjklmnpqrstvxwz';
 a:='aeiyouAEIOUY';
 readln(s);
 for i:=length(s) downto 1 do
  begin
    for j:=length(a) downto 1 do
      if a[j]=s[i] then begin
          writeln('YES');
          exit;
        end;
      for j:=length(b) downto 1 do
      if b[j]=s[i] then begin
          writeln('NO');
          exit;
        end;
  end;
end.

var
 i,s:longint;
 n:ansistring;
begin
 read(n);
 for i:=1 to length(n) do
  if ((n[i]>='a')and(n[i]<='z'))or((n[i]>='A')and(n[i]<='Z')) then s:=i;
 case n[s] of
  'A':write('YES');
  'E':write('YES');
  'I':write('YES');
  'O':write('YES');
  'U':write('YES');
  'Y':write('YES');
  'a':write('YES');
  'e':write('YES');
  'i':write('YES');
  'o':write('YES');
  'u':write('YES');
  'y':write('YES');
  else write('NO');
 end;
end.

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  s: string;
  i: integer;

begin
  //reset(input, 'input.txt');rewrite(output, 'output.txt');
  readln(s);
  for i := length(s) downto 1 do
  begin
    if not
    ((s[i] <> 'a') and (s[i] <> 'A') and
    (s[i] <> 'e') and (s[i] <> 'E') and
    (s[i] <> 'i') and (s[i] <> 'I') and
    (s[i] <> 'o') and (s[i] <> 'O') and
    (s[i] <> 'u') and (s[i] <> 'U') and
    (s[i] <> 'y') and (s[i] <> 'Y')) then
    begin
      writeln('YES');
      halt;
    end;
    if not
    ((s[i] <> 'b') and (s[i] <> 'B') and
    (s[i] <> 'c') and (s[i] <> 'C') and
    (s[i] <> 'd') and (s[i] <> 'D') and
    (s[i] <> 'f') and (s[i] <> 'F') and
    (s[i] <> 'g') and (s[i] <> 'G') and
    (s[i] <> 'h') and (s[i] <> 'H') and
    (s[i] <> 'j') and (s[i] <> 'J') and
    (s[i] <> 'k') and (s[i] <> 'K') and
    (s[i] <> 'l') and (s[i] <> 'L') and
    (s[i] <> 'm') and (s[i] <> 'M') and
    (s[i] <> 'n') and (s[i] <> 'N') and
    (s[i] <> 'p') and (s[i] <> 'P') and
    (s[i] <> 'q') and (s[i] <> 'Q') and
    (s[i] <> 'r') and (s[i] <> 'R') and
    (s[i] <> 's') and (s[i] <> 'S') and
    (s[i] <> 't') and (s[i] <> 'T') and
    (s[i] <> 'v') and (s[i] <> 'V') and
    (s[i] <> 'w') and (s[i] <> 'W') and
    (s[i] <> 'x') and (s[i] <> 'X') and
    (s[i] <> 'z') and (s[i] <> 'Z')) then
    begin
      writeln('NO');
      halt;
    end;
  end;
end.

var
s,st:string;
i:longint;
j:char;
 begin
   for j:='A' to 'Z' do
   st:=st+j;
   readln(s);
   s:=upcase(s);
   i:=length(s);
   while pos(s[i],st)=0 do
     dec(i);

      if s[i] in['A','E','I','O','U','Y'] THEN writeln('YES') else writeln('NO');
 end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

  var S,T : String;
  i : Integer;

begin
readln(S);
for i := 1 to Length(S) do T := T + LowerCase(S[Length(S) - (i-1)]);
i := 1;
while not((T[i] >= 'a') and (T[i] <= 'z')) do i := i + 1;
if ((T[i]='a')or(T[i]='e')or(T[i]='i')or(T[i]='o')or(T[i]='u')or(T[i]='y')) then  WriteLn('YES') else WriteLn('NO');
readln;
end.

{R+,S+,Q+,I+,O-}
{$R-,S-,Q-,I-,O+}

program kk;

{$APPTYPE CONSOLE}

uses
  SysUtils;

const glas = ['A','E','I','O','U','Y','a','e','i','o','u','y'];

var s : string;
    element : char;
    i : longint;

begin

  readln(s);

  for i:=length(s) downto 1 do begin
    if (s[i] in ['a'..'z']) or (s[i] in ['A'..'Z']) then begin
      element := s[i];
      break;
    end;
  end;

  if element in glas then writeln('YES')
  else writeln('NO');

end.

program p7;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
 a,b:array[1..10000] of string;
 x,y,k,l,m,n,i,j,p:longint;
 s,t,u:string;
begin
readln(s);
for i:=length(s) downto 1 do
if (s[i] in ['A'..'Z']) or (s[i] in ['a'..'z']) then begin  p:=i; break; end;
if (s[p]='A') or (s[p]='E') or (s[p]='I') or (s[p]='O') or (s[p]='U') or (s[p]='Y')
  or  (s[p]='a') or (s[p]='e') or (s[p]='i') or (s[p]='o') or (s[p]='u') or (s[p]='y')
  then write('YES') else write('NO');
end.

program Pq;
uses
SysUtils;
var
s:string;
j,l,i:longint;
const
a:array[1..12]of char=('A','E','I','O','U','Y','a','e','i','o','u','y');
begin
//reset(input,'input.txt');rewrite(output,'output.txt');
read(s);
l:=length(s);
for i:=l-1 downto 1 do
if s[i]<>' 'then
begin
for j:=1 to 12 do
if s[i]=a[j] then
begin
write('YES');
halt(0);
end;
write('NO');
halt(0);
end;
end.

var s:string;
    i,j,k:longint;
begin
  readln(s);
  s:=lowercase(s);
  k:=length(s);
  while (s[k]<'a')or(s[k]>'z') do k:=k-1;
  if (s[k]='a')or(s[k]='e')or(s[k]='i')
               or(s[k]='o')or(s[k]='u')or(s[k]='y') then writeln('YES')
                                                    else writeln('NO');
end.

{$R+,Q+,I+}
{$apptype console}
Uses SysUtils;
Const
   buk=['a'..'z','A'..'Z'];
   gl=['a','e','i','o','u','y','A','E','I','O','U','Y'];
Var
   s:String;
   f,i:Integer;
Begin
   ReadLn(s);
   f:=0;
   For i:=1 To length(s) Do
      If s[i] in buk Then
         If s[i] in gl Then f:=1
                       Else f:=0;
   If f=1 Then Write('YES')
          Else Write('NO');
End.

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
  const
 EngG=['A','E','I','O','U','Y','a','e','i','o','u','y'];
 EngS=['B','C','D','F','G','H','J','K','L','M','N','P','Q','R','S','T','V','W','X','Z',
       'b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','z'];
 Eng=EngG+EngS;
var  s:string;
     k:byte;
begin
  { TODO -oUser -cConsole Main : Insert code here }
   readln(s);
    k:=length(s);
     while not (s[k] in Eng) do
       k:=k-1;
     if s[k] in EngS then
      writeln('NO')
     else
      writeln('YES');
end.

uses math;
var
  s:string;
  i:longint;
function big(c:char):char;
  begin
    if (ord(c)>=65) and (ord(c)<=90) then c:=chr(ord(c)+32);
    exit(c);
  end;
begin
  read(s);
  for i:=1 to length(s) do
    s[i]:=big(s[i]);

  for i:=length(s)-1 downto 1 do
    if s[i]<>' ' then break;

  case s[i] of
    'a','e','i','o','u','y': begin write('YES'); halt; end;
  end;
  writeln('NO');
end.

var
 i:longint;
 s:string;
begin
 readln(s);
 for i:=length(s) downto 1 do
  begin
   if s[i] in ['a'..'z'] then begin
                               if (s[i]='a')or(s[i]='e')or(s[i]='i')or(s[i]='o')or(s[i]='u')or(s[i]='y') then writeln('YES')
                                                      else writeln('NO');
                               break;
                              end
                         else if s[i] in ['A'..'Z'] then begin
                                                          if (s[i]='A')or(s[i]='E')or(s[i]='I')or(s[i]='O')or(s[i]='U')or(s[i]='Y') then writeln('YES')
                                                                                else writeln('NO');
                                                          break;
                                                         end
  end;
end.

var k,i:longint;s:string;
begin
readln(s);
i:=length(s)-1;
while s[i-k]=' ' do inc(k);
if ((s[i-k]='a')or(s[i-k]='A')or(s[i-k]='e')or(s[i-k]='E')or(s[i-k]='i')or(s[i-k]='I')or(s[i-k]='o')or(s[i-k]='O')or(s[i-k]='u')or(s[i-k]='U')or(s[i-k]='y')or(s[i-k]='Y')) then
writeln('YES')
else
writeln('NO');
end.

program sleuth;
var s,c:string;
i,gar:integer;
begin
 readln (s);
 gar:=length(s);
 i:=gar;
 while (s[i]=' ') or (s[i]='?') do
  begin
   dec(i);
  end;
 c:=s[i];
 if (c='a') or (c='e') or (c='i') or (c='o') or (c='u') or (c='y') or (c='Y') or (c='U') or (c='O') or

(c='I') or (c='E') or (c='A') then
  begin
   writeln ('YES');
  end
  else
  begin
   writeln ('NO');
  end;
end.

{$MODE OBJFPC}
Program onlylove;
uses sysutils;
var s : ansistring;
   i : integer;
begin
  Readln(s);
  s := upcase(s);
  for i:= length(s) - 1 downto 1 do if s[i] <> ' '  then
  begin
  if s[i] in ['A', 'E', 'I','O', 'U', 'Y' ] then Writeln('YES') else
  Writeln('NO'); halt; break;   end;
end.

var s: string;
begin
  readln(s);
  while (length(s) > 0) and not(s[length(s)] in ['a'..'z','A'..'Z']) do delete(s, length(s), 1);
  if (s[length(s)] in ['a','e','i','o','u','y','A','E','I','O','U','Y']) then writeln('YES')
  else writeln('NO');
end.

uses sysutils;
var s:string;
    i:byte;
    c:char;
begin
    readln(s);
    s:=uppercase(s);
    delete(s,pos('?',s),length(s));
    for i:=length(s) downto 1 do
      if s[i] in['A'..'Z']then begin c:=s[i]; break end;
    if c in['A','E','Y','U','I','O']then writeln('YES')else writeln('NO');
end.

Var oz,i:longint;
s:string;
begin
readln(s);
i:=1;
while i<=length(s) do begin
if s[i]=' ' then delete(s,i,1) else i:=i+1;
end;
s:=Upcase(s);
oz:=0;
case s[length(s)-1]  of
'A':oz:=1;
'E':oz:=1;
'I':oz:=1;
'O':oz:=1;
'U':oz:=1;
'Y':oz:=1;
end;
if oz=1 then writeln('YES') else writeln('NO');
end.

program Sleuth;
var s:string;
    n,i:longint;
begin
    readln(s);
    i:=1;
    while i<length(s) do
    begin
        if s[i]=' ' then delete(s,i,1)
        else inc(i);
    end;
    n:=length(s);
    if (s[n-1]='A') or (s[n-1]='E') or (s[n-1]='I') or (s[n-1]='O') or (s[n-1]='U') or (s[n-1]='Y')
    or (s[n-1]='a') or (s[n-1]='e') or (s[n-1]='i') or (s[n-1]='o') or (s[n-1]='u') or (s[n-1]='y')
    then writeln('YES')
    else writeln('NO');
end.

program aneh;
var s:string;
        found:boolean;
        i:integer;
begin
        readln(s);
        i:=length(s);
        found:=false;
        while not(found) and (i>0) do
        begin
                if ((ord(s[i])>64) and (ord(s[i])<91))or((ord(s[i])>96) and (ord(s[i])<125)) then found:=true else dec(i);
        end;
        if (found) then
        begin
                case (s[i]) of
                'a','e','u','i','o','y','A','E','I','O','U','Y':writeln('YES');
                else  writeln('NO');
                end;
        end;
end.

Var i:longint;
    s,a:string;
    f:boolean;

Begin

  a:='aeiouyAEIOUY';
  readln(s);

  i:=1;
  while i<length(s) do begin
   if s[i]=' ' then delete(s,i,1) else
                                  inc(i);
  end;

  f:=false;
  for i:=1 to length(a) do
   if s[length(s)-1]=a[i] then begin
                           f:=true;
                           break;
                          end;

  if f then writeln('YES') else
                           writeln('NO');

End.

program sishik;
var t:string; i:integer;
begin
readln(t);
for i:=length(t) downto 1 do
if (t[i]=' ') or (t[i]='?') then delete(t,i,1)
else
if (t[i]='a') or (t[i]='A') or (t[i]='e') or (t[i]='E')
or (t[i]='o') or (t[i]='O') or (t[i]='i') or (t[i]='I')
or (t[i]='y') or (t[i]='Y') or (t[i]='u') or (t[i]='U') then
begin writeln('YES'); break end else begin writeln('NO'); break end
end.

var s, gl, sogl, res: string;
i, j:integer;
c: char;
begin
readln(s);
i:=length(s) - 1;
for j:=i downto 1 do
if s[j] <> ' ' then begin c := s[j]; break; end;
c := lowcase(c);
gl := 'aeuioy';
if gl.Contains(c) then write('YES')
else write('NO');
end.

const a:array[1..12] of char=('a','e','i','o','u','y','A','E','I','O','U','Y');
var s:string;
    i,j:byte;
begin
read(s);
for j:=length(s)-1 downto 1 do
if s[j]<>' ' then
begin
for i:=1 to 12 do
if s[j]=a[i] then begin write('YES'); halt; end;
break;
end;
write('NO');
end.

var
    e,r:longint;
    s:string;
begin
readln(s);
e:=length(s);
while (s[e]='?') or (s[e]=' ') do
    e:=e-1;
if (s[e]='a') or (s[e]='e') or (s[e]='i') or (s[e]='o') or (s[e]='y') or (s[e]='u') then r:=1;
if (s[e]='A') or (s[e]='E') or (s[e]='I') or (s[e]='O') or (s[e]='Y') or (s[e]='U') then r:=1;
if r=1 then write('YES') else write('NO');
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils, math;
  var n,i,m,x:longint; a,b:array [1..10000] of char; p:boolean;
begin
i:=0;
while not eoln do begin
i:=i+1;
read(a[i])
end;
p:=false;
i:=i-1;
x:=1;
while x=1 do begin
if ord(a[i])=32 then i:=i-1 else x:=2;
end;
if a[i]='A' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i]='a' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i]='E' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i]='e' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i]='I' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i]='i' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i]='O' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i]='o' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i]='U' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i]='u' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i]='Y' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i]='y' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if p=false then writeln('NO');
readln;
readln;
end.

program hgfhfhg;

{$APPTYPE CONSOLE}

uses
  SysUtils;

  var st:string;
      i:Integer;
begin

  Readln(st);

  for i:=Length(st) downto 1 do
   begin
    if  st[i] in ['A','E','I','O','U','Y','a','e','i','o','u','y'] then begin Writeln('YES'); break end
      else if st[i] in ['B','C','D','F','G','H','J','K','L','M','N','P','Q','R','S','T','V','W','X','Z','b','c','d','f','g','h','j','k','l','m','n','o','p','q','r','s','t','v','w','x','z'] then begin writeln('NO'); break end
   end;

  { TODO -oUser -cConsole Main : Insert code here }
end.

program Project_sushik;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
 s,s1:string;
 i,f,k:integer;
begin
read(s);
for i:=length(s) downto 1 do
  begin
   if (s[i]<>' ') and (s[i]<>'?') then
    begin
      s1:=s[i]; break;
    end;
  end;
if ((s1='a') or (s1='A') or(s1='e') or
   (s1='E') or (s1='i') or (s1='I') or
   (s1='o') or (s1='O') or (s1='u') or
   (s1='U') or (s1='Y') or (s1='Y'))
 then write('YES')  else write('NO');
read(f);
  { TODO -oUser -cConsole Main : Insert code here }
end.

const
    v='aeiouyAEIOUY';
var
    str:string; s:boolean;  i,j:longint;
begin
    readln(str);
    i:=length(str)-1;
    while str[i]=' ' do dec(i);
    for j:=1 to 12 do if str[i]=v[j] then s:=true;
    if s then writeln('YES') else writeln('NO');
    readln;
end.

program hrn;//#2
 var
  s:string;
  i,l:longint;
 begin
  read(s);
  l:=length(s)+1;
  repeat
   l:=l-1;
   i:=ord(s[l]);
  until((i>=65)and(i<=90))or((i>=97)and(i<=122));
  if(i>=65)and(i<=90)then i:=i+32;
  if(i=97)or(i=101)or(i=105)or(i=111)or(i=117)or(i=121)then write('YES')
                                                       else write('NO');
 end.

var n,k,i:integer;
s,c:string;
begin
readln(s);
k:=length(s)-1;
if s[k]=' ' then begin
                 repeat
                 k:=k-1;
                 until s[k]<>' ';
                 c:=s[k];
                 end
                 else c:=s[k];

if (c='a') or (c='e') or (c='i') or (c='o') or (c='u') or (c='y') or (c='A') or (c='E') or (c='I') or (c='O') or (c='U')
 or (c='Y') then write('YES')
else write('NO');
readln;
end.

program Project2;

{$APPTYPE CONSOLE}
var
   s: string;
   a1, b1, a2, b2:set of char;
   i: integer;
begin
  readln(s);
  i := 1;
  a1 := ['A', 'E', 'I','O', 'U', 'Y'];
  a2 := ['a', 'e', 'i', 'o', 'u', 'y'];
  b1 := ['B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Z'];
  b2 := ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'z'];
  while i <> length(s) do
  if (s[length(s)-i] in ['A'..'Z']) or (s[length(s)-i] in ['a'..'z']) then
    begin
      if (s[length(s)-i] in a1) or (s[length(s)-i] in a2) then
      begin
        writeln('YES');
        exit;
      end
    else
      begin
        writeln('NO');
        exit;
      end;
    end
  else
    inc(i);
end.

var a,b,c,d,e,f : longint;
s : string;
begin
readln (s);
for a := length(s) downto 1 do  begin
if (s[a]<>' ') and (s[a]<>'?') and (s[a]<>',') and (s[a]<>'.') then begin
if (s[a] = 'a') or (s[a] = 'e') or (s[a] = 'i') or (s[a] = 'o') or (s[a] = 'u') or (s[a] = 'y') or
(s[a] = 'A') or (s[a] = 'E') or (s[a] = 'I') or (s[a] = 'O') or (s[a] = 'U') or (s[a] = 'Y')
then writeln ('YES')
else writeln ('NO');
break;
end;
end;
end.

var
s,st:string;
i:longint;
j:char;
 begin
   for j:='A' to 'Z' do
   st:=st+j;
   readln(s);
   s:=upcase(s);
   i:=length(s);
   while pos(s[i],st)=0 do
     dec(i);

      if s[i] in['A','E','I','O','U','Y'] THEN writeln('YES') else writeln('NO');
 end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

function max(a,b:longint):longint;
begin
  if a<b then max:=b else max:=a;
end;

var i:longint;
    s:string;

begin
  readln(s);
  for i:=length(s) downto 1 do
  begin
    if s[i]in['?',' '] then continue;
    if s[i]in['A','a','E','e','I','i','O','o','U','u','Y','y'] then writeln('YES') else writeln('NO');
    exit;
  end;
end.

{$r-,s-,q-,i-,o+}
var
  s:ansistring;
  i:longint;
begin
  readln(s);
  for i:=length(s) downto 1 do
    if (s[i] in ['a'..'z','A'..'Z']) then
      begin
        if (pos(s[i],'aeiouyAEIOUY')>0) then writeln('YES') else
          writeln('NO');
        halt(0);
      end;
end.

const
    x=['a','e','i','o','u','y'];
    y=['A','E','I','O','U','Y'];
var
    s:string[100];
    i:longint;
begin
    readln(s);
    for i:=length(s) downto 1 do
        if s[i] in ['a'..'z','A'..'Z'] then
        begin
            if (s[i] in x) or (s[i] in y) then write('YES')
                else write('NO');
            exit;
        end;
end.

var l:string;
    i:integer;
    p:boolean;
begin
     readln(l);
     i:=length(l)+1;
     p:=false;
     while p=false do begin
           dec(i);
           case l[i] of
                'A'..'z': p:=true;
           end;
     end;
     case l[i] of
          'A','E','I','O','U','Y','a','e','i','o','u','y':writeln ('YES');
          else writeln('NO');
     end;
end.

var s:string;
    i:longint;
begin
 readln(s);
 s:=upcase(s);
 i:=length(s);
 while not((s[i] in ['a'..'z'])or(s[i] in ['A'..'Z'])) do
  i:=i-1;
 case s[i] of
  'A','E','I','O','U','Y':writeln('YES');
  else writeln('NO');
 end;
end.

program task;
var s:string;
    i:byte;
begin
  readln(s);
  i:=length(s)-1;
  while (s[i]=' ') do
    dec(i);
  if s[i]in['A','E','I','O','U','Y',
             'a','e','i','o','u','y'] then
    writeln('YES')
  else
    writeln('NO')
end.

program PrA;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  StrUtils;

var s: string;
    i: longint;

begin
  readln(s);
  s := UpperCase(s);
  for i := length(s)downto 1 do
      if (ord(s[i]) >= ord('A'))and(ord(s[i]) <= ord('Z'))then
      begin
           if (s[i] = 'A')or(s[i] = 'E')or(s[i] = 'I')or
              (s[i] = 'O')or(s[i] = 'U')or(s[i] = 'Y')then
              writeln('YES') else
              writeln('NO');
           halt(0);
      end;

end.

var
  a,b,i:longint;
  s,x:string;
begin
 b:=0;
  readln(s);
   i:=length(s)-1;
   while (s[i-b]='?')or(s[i-b]=' ')do
   begin
    b:=b+1;
   end;
  if (s[i-b]='a')or(s[i-b]='A')or(s[i-b]='e')or(s[i-b]='E')or(s[i-b]='i')or(s[i-b]='I')or(s[i-b]='o')or(s[i-b]='O')or(s[i-b]='u')or(s[i-b]='U')or(s[i-b]='y')or(s[i-b]='Y') then
   writeln('YES')
    else
     writeln('NO');
end.

var s:string;
begin
read(s);
s:=upcase(s);
while not(s[length(s)] in['A'..'Z']) do
  delete(s,length(s),1);
if s[length(s)] in['A','E','I','O','U','Y'] then write('YES') else write('NO');
end.

program bangke;
var
        a : array [1..1000] of char;
        i : integer;
        x : char;
begin
        i := 0;
        repeat
        i := i + 1;
        read (a[i]);
        until eoln;

        i := i + 1;

        repeat
        i := i - 1;
        x := a[i];
        until (a[i] <> '?') and (a[i] <> ' ');
        if (a[i] = 'a') or (a[i] = 'e') or (a[i] = 'i') or (a[i] = 'u') or (a[i] = 'o') or (a[i] ='y') or (a[i] = 'A') or (a[i] = 'E') or (a[i] = 'I') or (a[i] = 'U') or (a[i] = 'O') or (a[i] ='Y') then
                writeln ('YES')
                else
                        writeln ('NO');
end.

program _49A;
var
  s :string;
  i : longint;
begin
  read(s);
  i := length(s) - 1;
  while s[i] = ' ' do
    dec(i);
  if UpCase(s[i]) in ['A', 'E', 'I', 'O', 'U', 'Y']
     then write('YES')
     else write('NO');
end.

{q+,r+,i+,o-,s+}
type
  int32=longint;
  bool=boolean;
const
  g=6;
  g1:array[1..6] of char=('A','E','I','O','U','Y');
  g2:array[1..6] of char=('a','e','i','o','u','y');
var
  i :int32;
  s :string;
procedure f1(x  :char);
begin
  for i:=1 to g do
    if g1[i]=x then
    begin
      write('YES');
      halt(0);
    end;
    write('NO');
    halt(0);
end;
procedure f2(x  :char);
begin
  for i:=1 to g do
    if g2[i]=x then
    begin
      write('YES');
      halt(0);
    end;
    write('NO');
    halt(0);
end;
begin
//  reset(input,'input.txt');
//  rewrite(output,'output.txt');
  readln(s);
  for i:=length(s) downto 1 do
  begin
    if (ord(s[i])>=65)and (ord(s[i])<=90) then f1(s[i]);
    if (ord(s[i])>=97)and(ord(s[i])<=122) then f2(s[i]);
  end;
end.

var s:ansistring;
    i:longint;
begin
  readln(s);i:=length(s);
  while not(upcase(s[i])in['A'..'Z']) do dec(i);
  if upcase(s[i])in['A','E','I','O','U','Y'] then
    writeln('YES')
  else
    writeln('NO');
end.

program codef_46_A;

{$APPTYPE CONSOLE}

uses
  SysUtils;

const a:array[1..12]of char=('A', 'E', 'I', 'O', 'U', 'Y','a','e','i','o','u','y');

var s:string;
    i,j:integer;

begin
  {reset(input,'input.txt');
  rewrite(output,'output.txt');
  }read(s);
  i:=pos('?',s)-1;
  while s[i]=' ' do dec(i);
  for j:=1 to 12 do
    if s[i]=a[j] then begin
      write('YES');
      halt;
    end;
  write('NO');
end.

var
i,j,c,d,e,b,n:longint;
s,s1,s2,s3,s4:string;
begin
read(s);
s:=lowercase(s);
for i:=length(s) downto 1 do
if s[i] in ['a'..'z'] then begin j:=i;break;end;
if s[j] in ['a','i','e','o','u','y'] then writeln('YES')
else
writeln('NO');
end.

program A;

{$APPTYPE CONSOLE}
{$O-}

uses
  SysUtils,
  Math;
type
  int = longint;
var
  s : string;
  i : int;
begin

  readln(s);
  for i := length(s) downto 1 do
    if s[i] in ['a'..'z', 'A'..'Z'] then
      break;
  if s[i] in ['A', 'E', 'I', 'O', 'U', 'Y', 'a', 'e', 'i', 'o', 'u', 'y'] then
    writeln('YES') else
      writeln('NO');

end.

program pja;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  iCnti: integer;
  sGiven: string;

function WhichLetter(s1: string): integer;
begin
  s1 := UpperCase(s1);
  case s1[1] of
    'A','E','I','O','U','Y':
      WhichLetter := 0;
    'B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q',
     'R', 'S', 'T', 'V', 'W', 'X', 'Z':
      WhichLetter := 1;
    else WhichLetter := -1;
    end;
end;

begin
//  Assign(Input,'source.txt'); Reset(Input);
  Readln(sGiven);
  iCnti := Length(sGiven);
  while (WhichLetter(sGiven[iCnti]) = -1) do begin
    Dec(iCnti);
    end;
  case WhichLetter(sGiven[iCnti]) of
    0: Writeln('YES');
    1: Writeln('NO');
    end;
end.

Var s:string;
N,k:longint;
Begin
Readln(s);
For k:=length(s) downto 1 do
    if ((s[k]>='A') and (s[k]<='Z')) or ((s[k]>='a') and (s[k]<='z')) then
        if (s[k]='A') or (s[k]='E') or  (s[k]='I') or (s[k]='O') or (s[k]='U') or (s[k]='Y') or  (s[k]='a') or (s[k]='e') or (s[k]='i') or (s[k]='o') or (s[k]='u') or (s[k]='y') then begin
            write('YES');
            halt(0);
        end
        else begin
            write('NO');
            halt(0);
        end;
end.

program detective;
var
 s:string[100];
 l:integer;
begin
 read(s);
 l:=length(s)-1;
 while s[l]=' 'do dec(l);
 case s[l] of
  'a','e','i','o','u','y','A','E','I','O','U','Y':writeln('YES');
  else writeln('NO');
 end;
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var s:string;
    n,i,x:integer;
begin
readln(s);
n:=length(s);
for i:=n downto 1 do
  if s[i] in ['a'..'z','A'..'Z'] then begin x:=i; break; end;
//writeln(x,' ',s[x]);
if (pos(s[x],'AEIOUY')<>0) or (pos(s[x],'aeiouy')<>0) then writeln('YES')
                                                      else writeln('NO');
end.

var
  st: string;
  i: integer;
  c: char;

begin

  readln(st);

  for i:=Length(st) downto 1 do
    if (st[i] in ['a'..'z']) or (st[i] in ['A'..'Z']) then begin c:=st[i]; break; end;

  case c of
  'A': write('YES');
  'E': write('YES');
  'I': write('YES');
  'O': write('YES');
  'U': write('YES');
  'Y': write('YES');
  'a': write('YES');
  'e': write('YES');
  'i': write('YES');
  'o': write('YES');
  'u': write('YES');
  'y': write('YES');
  else write('NO');
  end;
end.

program Syshik;
{$APPTYPE CONSOLE}
uses
  SysUtils;
 var str:string;
     i,n:integer;
begin
readln(str);
n:=length(str)-1;
while str[n]=' ' do
dec(n);
if str[n] in ['A','E','I','O','U','Y','a','e','i','o','u','y']then write('YES')
else write('NO');
  { TODO -oUser -cConsole Main : Insert code here }
end.

var
    s:string;
    i:integer;
begin
    read(s);
    for i:=length(s) downto 1 do if (s[i] in ['a'..'z'])or(s[i] in ['A'..'Z']) then begin
        if (s[i] in ['A','E','I','O','U','Y'])or(s[i] in ['a','e','i','o','u','y']) then write('YES') else write('NO');
        halt;
    end;
end.

program codeforces_round46_a;

const
  a = 'AEIOUYaeiouy';

var
  s : string;
  i : byte;

begin
  read(s);
  for i:=length(s) downto 1 do
    if (s[i] in ['a'..'z']) or (s[i] in ['A'..'Z'])
       then begin
              if pos(s[i], a) <> 0
                 then write('YES')
                 else write('NO');
              break;
            end;
end.

var s:string;
    i:longint;
begin
  read(s);
  for i:=length(s) downto 1 do
  if (s[i]<='z')and(s[i]>='a')or(s[i]<='Z')and(s[i]>='A') then break;
  if (s[i]='A')or(s[i]='E')or(s[i]='I')or(s[i]='O')or(s[i]='U')or(s[i]='Y')or(s[i]='a')or(s[i]='e')or(s[i]='i')or(s[i]='o')or(s[i]='u')or(s[i]='y')
  then write('YES') else write('NO');
end.

var
  s:string;
  i:longint;
begin
  readln(s);
  for i:=length(s) downto 1 do
    if s[i] in['a'..'z','A'..'Z'] then
    begin
      if s[i] in['a','e','i','o','u','y','A','E','I','O','U','Y']
      then writeln('YES') else writeln('NO');
      exit;
    end;
end.

var
s,st:string;
i:longint;
j:char;
 begin
   for j:='A' to 'Z' do
   st:=st+j;
   readln(s);
   s:=upcase(s);
   i:=length(s);
   while pos(s[i],st)=0 do
     dec(i);

      if s[i] in['A','E','I','O','U','Y'] THEN writeln('YES') else writeln('NO');
 end.

program task46_A;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  str: string;
  g: set of char;
  k: set of char;
  i: integer;
begin
   Readln(str);
   g:=['a','i','o','y','u','e', 'A','I','O','Y','U','E'];
   k:=[' ','?'];
   i:=Length(str);
   while (i>=1) do
   begin
     if (str[i] in k) then Dec(i)
     else
       if (str[i] in g) then
       begin
         Writeln('YES');
         break;
       end
       else
       begin
         Writeln('NO');
         break;
       end;
   end;
  { TODO -oUser -cConsole Main : Insert code here }
end.

var s:ansistring;
    i:longint;
begin
  readln(s);i:=length(s);
  while not(upcase(s[i])in['A'..'Z']) do dec(i);
  if upcase(s[i])in['A','E','I','O','U','Y'] then
    writeln('YES')
  else
    writeln('NO');
end.

var
 s:ansistring;
 j:longint;
begin
 readln(s);
 s:=upcase(s);
 j:=length(s);
 while not(s[j] in ['A'..'Z']) do
  dec(j);
 if s[j] in ['A','E','I','O','U','Y'] then writeln('YES')
                                                  else writeln('NO');
end.

var s:string;
    a,i:longint;
begin
readln(s);
a:=length(s);
for i:=a-1 downto 1 do
if s[i]<>' ' then
break;
if (s[i]='A')or(s[i]='a')or(s[i]='E')or(s[i]='e')or(s[i]='I')or(s[i]='i')or(s[i]='O')or(s[i]='o')or(s[i]='U')or(s[i]='u')or(s[i]='Y')or(s[i]='y')then
writeln('YES')
else
writeln('NO');
end.

var
s,st:string;
i:longint;
j:char;
 begin
   for j:='A' to 'Z' do
   st:=st+j;
   readln(s);
   s:=upcase(s);
   i:=length(s);
   while pos(s[i],st)=0 do
     dec(i);

      if s[i] in['A','E','I','O','U','Y'] then writeln('YES') else writeln('NO');//因为是大写，所以不必判断是不是小写字符
 end.

{$R+ Q+ I+}
{$APPTYPE CONSOLE}
uses
  SysUtils;
const
    L=['A'..'Z','a'..'z'];
    N=['A', 'E', 'I', 'O', 'U', 'Y','a','e','i','o','u','y'];
 var
   i,j,k,q:integer;
   S:string;
   c:char;
begin
   while not seekeof do begin
         read(c);
         if c in L then begin
            S:='';
            while c in L do begin
                  s:=s+c;
                  if eof then break;
                  read(c);
            end;
          end;
   end;

   if s[length(s)] in N then write('YES')
                        else write('NO');
   end.

var
 st:string;
procedure yb;
var i:longint;
begin
  delete(st,length(st),1);
  i:=length(st);
  while st[i]=' ' do begin delete(st,i,1);dec(i);end;
end;
begin
  readln(st);
  yb;
  if st[length(st)] in ['A','E','I','O','U','Y','a','e','i','o','u','y'] then writeln('YES')
    else writeln('NO');
end.

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
i:integer;
s:string;
begin
  //reset(input,'input.txt');
  //rewrite(output,'output.txt');
  readln(s);
  i:=length(s);
  while not((ORD(S[I])>=ord('a'))and(ORD(S[I])<=ord('z')))and
        not((ORD(S[I])>=ord('A'))and(ORD(S[I])<=ord('Z'))) do dec(i);
  case s[i] of
    'a': BEGIN writeln('YES'); halt(0); end;
    'e': BEGIN writeln('YES'); halt(0); end;
    'o': BEGIN writeln('YES'); halt(0); end;
    'u': BEGIN writeln('YES'); halt(0); end;
    'y': BEGIN writeln('YES'); halt(0); end;
    'i': BEGIN writeln('YES'); halt(0); end;
    'A': BEGIN writeln('YES'); halt(0); end;
    'E': BEGIN writeln('YES'); halt(0); end;
    'Y': BEGIN writeln('YES'); halt(0); end;
    'I': BEGIN writeln('YES'); halt(0); end;
    'O': BEGIN writeln('YES'); halt(0); end;
    'U': BEGIN writeln('YES'); halt(0); end;
  end;
  writeln('NO');

end.

var a,b,c,d,e,f,g,j,brojac:longint;
var s,s1,s2,s3:shortstring;
begin

 readln(s);

  for j:=length(s)-1 downto 1 do
    begin
      if s[j]=' '
        then inc(brojac)
      else break;
    end;

    if brojac>0
     then begin
       delete(s,length(s)-(brojac-1),brojac);
         end;

 if (s[length(s)-1] in ['a','e','i','o','u','y','A','E','I','O','U','Y'])
    then writeln('YES')
 else writeln('NO');
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  system;

Var
 i, j:integer;
 s:string;
begin
  readln(s);
  i:=length(s)-1;
  for j := 1 to length(s) do
    begin
      if (s[i]<>' ') and (s[i]<>'.') and (s[i]<>',') and (s[i]<>'!') then
        begin
          if (s[i]='a') or (s[i]='e') or (s[i]='i') or (s[i]='o') or (s[i]='u') or (s[i]='y') or (s[i]='A') or (s[i]='E') or (s[i]='I') or (s[i]='O') or (s[i]='U') or (s[i]='Y') then
            begin
              writeln('YES');
              exit;
            end
          else
            begin
             writeln('NO');
             exit;
            end;
        end;
      if (s[i]=' ') or (s[i]='.') or (s[i]=',') or (s[i]='!') then
        begin
          i:=i-1;
        end;
    end;
end.

var S : string[100];
    i : longint;
begin
     readln(S);
     i := length(S);
     while not((ord(S[i]) in [97..122]) or (ord(S[i]) in [65..90])) do dec(i);
     case S[i] of
          'a', 'e', 'i', 'o', 'u', 'y' : writeln('YES');
          'A', 'E', 'I', 'O', 'U', 'Y' : writeln('YES');
          else writeln('NO');
     end;
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;
type
  list=array[1..1000000]of integer;
var
  a,b:list;
  n,k,p,i,j,h,l,g,c,e,k1,y,k2,z,m,k3,k4:Integer;
  s:string;
procedure quicksort(var b:list; left,right:integer);
var
  i,j,temp,p:integer;
begin
  i:=left;
  j:=right;
  p:=b[(left+right)div 2];
  repeat
    while(b[i]<p)do inc(i);
    while(b[j]>p) do dec(j);
    if(i<=j)then begin
      temp:=b[i];
      b[i]:=b[j];
      b[j]:=temp;
      inc(i);
      dec(j);
    end;
  until(i>j);
  if(j>left)then quicksort(b,left,j);
  if(i<right)then quicksort(b,i,right);
end;
begin
  Readln(s);
  for i:=Length(s) downto 1 do
    begin
      if (s[i] in ['a'..'z']) or (s[i] in ['A'..'Z']) then
        begin
          if (s[i] in ['a','e','y','u','i','o','A','E','Y','U','I','O'])then write('YES')
            else write('NO');
          Break;
        end;
    end;
Readln;
Readln;
end.

program problemA;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  fayl:Text;
  s:string;
begin
  readln(s);
  while not (s[length(s)] in ['A'..'Z','a'..'z']) do delete(S,length(s),1);
  if upcase(S[length(S)]) in ['A','E','I','O','Y','U'] then write('YES') else write('NO');

  { TODO -oUser -cConsole Main : Insert code here }
end.

program giylmi;

{$APPTYPE CONSOLE} {$o- r- q+}

uses
  SysUtils, Math;

var
  s: string;
  i: integer;
  b: boolean;
begin
  //reset(input, 'input.txt');
  //rewrite(output, 'output.txt');
  readln(s);
  i := length(s) + 1;
  b := true;
  while b do begin
    dec(i);
    if ((s[i] >= 'a') and (s[i] <= 'z')) or
       ((s[i] >= 'A') and (s[i] <= 'Z')) then
       b := false;
  end;
  if s[i] <= 'Z' then
    s[i] := chr(ord(s[i]) + 32);
  case s[i] of
    'a': begin write('YES'); halt(0); end;
    'e': begin write('YES'); halt(0); end;
    'i': begin write('YES'); halt(0); end;
    'o': begin write('YES'); halt(0); end;
    'u': begin write('YES'); halt(0); end;
    'y': begin write('YES'); halt(0); end;
  end;
  write('NO');
end.

var ok : boolean;
    q : char;
    k : longint;
 begin
  ok := true;
  while q <> '?' do
   begin
    read(q);
    if q in ['a'..'z','A'..'Z'] then
     begin
    if q in ['A','E','I','O','U','Y','a','e','i','o','u','y'] then ok := true
    else ok := false;
      k := k + 1;
     end;
   end;
   if k <> 0 then
  if ok then writeln('YES')
  else writeln('NO');
 end.

var i:longint; s:string;
 begin
  readln (s);
  for i:=length(s) downto 1 do
   if s[i] in ['A'..'Z','a'..'z'] then break;
  if s[i] in ['A','E','I','O','U','Y','a','e','i','o','u','y'] then writeln ('YES')
                                                               else writeln ('NO');
 end.

program hrn;//thfqwjmexjhgqwgscyxhjbwqghjb
 var
  s:string;
  i,l:longint;
 begin
  read(s);
  l:=length(s)+1;
  repeat
   l:=l-1;
   i:=ord(s[l]);
  until((i>=65)and(i<=90))or((i>=97)and(i<=122));
  if(i>=65)and(i<=90)then i:=i+32;
  if(i=97)or(i=101)or(i=105)or(i=111)or(i=117)or(i=121)then write('YES')
                                                       else write('NO');
 end.

{$R+,S+,Q+,I+,O-}
{$APPTYPE CONSOLE}
const v:set of char=['A', 'E', 'I', 'O', 'U', 'Y'];
var s:string; i:longint;
begin
readln(s);
i:=length(s);
while (not(s[i] in ['A'..'Z'])) and  (not(s[i] in ['a'..'z'])) do dec(i);
if (chr(ord(s[i])+32) in v) or (s[i] in v) then writeln('YES') else writeln('NO');
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils, math;
  var n,i,m,x:longint; a,b:array [1..10000] of char; p:boolean;
begin
i:=0;
while not eoln do begin
i:=i+1;
read(a[i])
end;
p:=false;
if a[i-1]='A' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i-1]='a' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i-1]='I' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i-1]='i' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i-1]='O' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i-1]='o' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i-1]='U' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i-1]='u' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i-1]='Y' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i-1]='y' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if p=false then writeln('NO');
readln;
readln;
end.

const a:array[1..10]of char=('A','E','I','O','U','a','e','i','o','u');
var s:string;i,j:longint;f:boolean;
begin
  readln(s);
  for i:=length(s)downto 1 do
  begin
    if (s[i] in['A'..'Z'])or(s[i]in['a'..'z'])then
    begin
      f:=false;
      for j:=1 to 10 do
      if a[j]=s[i] then f:=true;
      if f  then writeln('YES')
      else writeln('NO');
      halt;
    end;
  end;
end.

var
s,a,b:string;
i,j:integer;
begin
read(s);
a:='AEIOUYaeiouy';
b:='QWRTPSDFGHJKLZXCVBNMqwrtpsdfghjklzxcvbnm';
for i:=length(s) downto 1 do
if s[i]<>' ' then j:=i;
for i:=1 to length(a) do
if s[j]=a[i] then writeln('YES');
for i:=1 to length(b) do
if s[j]=b[i] then writeln('NO');

end.

var
  m: integer;
  s, l: string;

begin
  read(s);
  m := length(s);
  repeat
    m := m - 1;
  until s[m] <> ' ';

  l := 'euoiayEYUIOA';
  if pos(s[m], l) <> 0 then
    writeln('YES');

  l := 'bcdfghjklmnpqrrstvwBCDFGHJKLMNPQRSTVW';
  if pos(s[m], l) <> 0 then
    writeln('NO')

end.

var
	i:longint;
	st:string;
begin
	readln(st);
        upcase(st);
	for i:=length(st) downto 1 do
		if st[i] in ['a'..'z'] then
			if (st[i]='A') or (st[i]='E') or (st[i]='I') or (st[i]='O') or (st[i]='U') or (st[i]='Y') then
			begin
				writeln('YES');
				exit;
			end else
			begin
				writeln('NO');
				exit;
			end;
end.

program anApple;

{$APPTYPE CONSOLE}

uses
  SysUtils;

const c : array [1..12] of char = ('A', 'E', 'I', 'O', 'U', 'Y', 'a', 'e', 'i', 'o', 'u', 'y');

var
  s : string;
  i : integer;

function isinc (ch : char) : boolean;

var
  i : byte;

begin
  for i := 1 to 12 do if ch = c [i] then begin
    isinc := True;
    Exit;
  end;
  isinc := False;
end;

begin
  Readln (s);
  if isinc (s [Length (s)-1]) then Writeln ('YES') else Writeln ('NO');
  Readln;
end.

var
	n, h, m, r, x, sum, y: integer;
	flag: boolean = false;
	s, l: string;

begin

	readln(s);

	l := 'euoiayEYUIOA';
	for var i := 1 to l.length do
	begin
		if (s[s.length-1] = l[i]) then
		begin
			writeln('YES');
			flag := true;
			break;
		end;
	end;

	if (flag <> true) then
		writeln('NO');

end.

program bangke;
var
        a : array [1..1000] of char;
        i : integer;
        x : char;
begin
        i := 0;
        repeat
        i := i + 1;
        read (a[i]);
        until eoln;

        repeat
        x := a[i];
        i := i - 1;
        until (a[i] <> '?') and (a[i] <> ' ');
        if (a[i] = 'a') or (a[i] = 'e') or (a[i] = 'i') or (a[i] = 'u') or (a[i] = 'o') or (a[i] ='y') then
                writeln ('YES')
                else
                        writeln ('NO');
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  system;

Var
 i:integer;
 s:string;
begin
  readln(s);
  i:=length(s)-1;
  if (s[i]='a') or (s[i]='e') or (s[i]='i') or (s[i]='o') or (s[i]='u') or (s[i]='y') or
    (s[i]='A') or (s[i]='E') or (s[i]='I') or (s[i]='O') or (s[i]='U') or (s[i]='Y') then
  writeln('YES')
  else
  writeln('NO');
end.

var s:string;
    k:integer;
begin
readln(s);
for k:=length(s) downto 1 do
 if((s[k]>='A')and(s[k]<='Z'))or((s[k]>='a')and(s[k]<='z'))then

                begin
    if(s[k]='A')or(s[k]='E')or(s[k]='I')or
      (s[k]='O')or(s[k]='U')or(s[k]='Y')then writeln('YES')else
                                             writeln('NO');
                                 break;
                                 end;

end.

var
    a:string;
    i,j,k,l:longint;
begin
    readln(a);
    for i:=length(a)  downto 1 do
        begin
          if ((a[i]>='A') and (a[i]<='Z')) or ((a[i]<='z') and (a[i]>='a'))  then
              begin
                 case a[i] of
                 'A':begin writeln('YES'); readln; readln; exit; end;
                 'E':begin writeln('YES'); readln; readln; exit; end;
                 'I':begin writeln('YES'); readln; readln; exit; end;
                 'O':begin writeln('YES'); readln; readln; exit; end;
                 'U':begin writeln('YES'); readln; readln; exit; end;
                 'a':begin writeln('YES'); readln; readln; exit; end;
                 'e':begin writeln('YES'); readln; readln; exit; end;
                 'i':begin writeln('YES'); readln; readln; exit; end;
                 'o':begin writeln('YES'); readln; readln; exit; end;
                 'u':begin writeln('YES'); readln; readln; exit; end;
                 'y':  begin writeln('YES'); readln; readln; exit; end;
                 'Y': begin writeln('YES'); readln; readln; exit; end;
                 end;
                 end;
                 end;
                 writeln('NO');
                 readln;
                 readln;

end.

var
   cad:string[110];
   i,L:integer;
   c:set of char;
begin
  c:=['a','e','i','o','u','A','E','I','O','U'];
  readln(cad);
  L:=length(cad);
  while ((cad[L]<'a') or (cad[L]>'z'))AND (cad[L]<'A') or (cad[L]>'Z') do
     L:=L-1;
  if cad[L] in c then
     writeln('YES')
  ELSE
     writeln('NO');
end.

program sleuth;
const fi='';
      fo='';
var s:string;i:longint;
begin
assign(input,fi);reset(input);
assign(output,fo);rewrite(output);
read(s);
for i:=length(s) downto 1 do
if ((s[i]>='a') and (s[i]<='z')) or ((s[i]>='A') and (s[i]<='Z')) then
        begin
        if s[i] in['a','e','i','o','u','y'] then write('YES')
        else write('NO');
        if s[i] in['A','E','I','O','U','Y'] then write('YES')
        else write('NO');
        break;
        end;
close(input);close(output);
end.

var s,s1:string;i,j,k:longint;
begin
{assign(input,'input.txt');reset(input);
assign(output,'output.txt');rewrite(output); }
s1:='AEIOUYaeiouy';
readln(s);
i:=length(s);
while (i>=1)and(s[i]=' ')or(s[i]='?')do dec(i);
if pos(s[i],s1)<>0 then writeln('YES') else writeln('No');
end.

var
  s:ansistring;
begin
  readln(s);
  if s[length(s)-2] in ['a','e','i','o','u','y','A','E','I','O','U','Y'] then
  writeln('YES') else writeln('NO');
end.

program P49A;

{$APPTYPE CONSOLE}

uses
  Math, SysUtils;
var
  s: string;
  i, k: longint;
begin
  read(s);
  k := 0;
  for i := 1 to length(s) - 1 do
    if(s[i] <> ' ') then
      k := i;
  if(s[k] = 'A') or (s[k] = 'E') or (s[k] = 'I')
  or (s[k] = 'O') or (s[k] = 'U') or (s[k] = 'Y') then
    write('YES')
  else
    write('NO');
end.

program sleuth;
const fi='';
      fo='';
var s:string;i:longint;
begin
assign(input,fi);reset(input);
assign(output,fo);rewrite(output);
read(s);
for i:=length(s) downto 1 do
if (s[i]>='a') and (s[i]<='z') then
        begin
        if s[i] in['a','e','i','o','u','y'] then write('YES')
        else write('NO');
        break;
        end;
close(input);close(output);
end.

var
a:string;
n:longint;
begin
read(a);
n:=length(a)-1;
if (a[n]='A') or (a[n]='E') or (a[n]='I') or  (a[n]='O') or (a[n]='U') or (a[n]='Y') or (a[n]='a') or (a[n]='e') or (a[n]='i') or (a[n]='o') or (a[n]='u') or (a[n]='y') then write('YES')
else write('NO');
end.

var
  a,b,i:longint;
  s,x:string;
begin
 b:=0;
  readln(s);
   i:=length(s)-1;
    repeat
     if (s[i-b]='?')or(s[i-b]=' ') then inc(b)
      else break;
    until true;
  if (s[i-b]='a')or(s[i-b]='A')or(s[i-b]='e')or(s[i-b]='E')or(s[i-b]='i')or(s[i-b]='I')or(s[i-b]='o')or(s[i-b]='O')or(s[i-b]='u')or(s[i-b]='U')or(s[i-b]='y')or(s[i-b]='Y') then
   writeln('YES')
    else
     writeln('NO');
end.

program zA;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var s,ans:string;
    i:longint;

begin
  ans:='No';
  readln(s);
  for i:=1 to length(s) do
  begin
    if s[i]in[' ','?'] then continue;
    if s[i] in ['a','e','i','o','u','y','A','E','I','O','U','Y']then ans:='YES' else ans:='No';
  end;
  writeln(ans);
end.

var
  s:string;
begin
  readln(s);
  if s[length(s)-1] in ['a','e','i','o','u','y','A','E','I','O','U','Y'] then
  writeln('YES') else writeln('NO');
end.

var
	i:longint;
	st:string;
begin
	readln(st);
        upcase(st);
	for i:=length(st) downto 1 do
		if st[i] in ['a'..'z'] then
			if (st[i]='A') or (st[i]='E') or (st[i]='I') or (st[i]='O') or (st[i]='U') or (st[i]='Y') then
			begin
				writeln('YES');
				exit;
			end else
			begin
				writeln('NO');
				exit;
			end;
end.

var
 st:string;
begin
  readln(st);
  if st[length(st)-1] in ['A','E','I','O','U','Y','a','e','i','o','u','y'] then writeln('YES')
    else writeln('NO');
end.

var
a:string;
n:longint;
begin
read(a);
n:=length(a);
if (a[n]='A') or (a[n]='E') or (a[n]='I') or  (a[n]='O') or (a[n]='U') or (a[n]='Y') then write('YES')
else write('NO');
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

  var S,T : String;
  i : Integer;

begin
readln(S);
for i := 1 to Length(S) do T := T + LowerCase(S[Length(S) - (i-1)]);
i := 1;
while not((T[i] >= 'a') and (T[i] <= 'z')) do i := i + 1;
if ((T[i]<>'A')and(T[i]<>'E')and(T[i]<>'I')and(T[i]<>'O')and(T[i]<>'U')and(T[i]<>'Y')) then  WriteLn('YES') else WriteLn('NO');
readln;
end.

program sleuth;
var
s:string;
begin
readln(s);
if lowercase(s[length(s)-1]) = 'a' then writeln('YES') else
if lowercase(s[length(s)-1]) = 'e' then writeln('YES') else
if lowercase(s[length(s)-1]) = 'i' then writeln('YES') else
if lowercase(s[length(s)-1]) = 'o' then writeln('YES') else
if lowercase(s[length(s)-1]) = 'u' then writeln('YES') else
if lowercase(s[length(s)-1]) = 'y' then writeln('YES') else writeln('NO');
end.

program sleuth;
var
s:string;
c:char;
i:integer;
begin
readln(s);
for i:=length(s) downto 1 do
if (s[i]<>' ') and (s[i]<>'?') then begin c:=s[i]; break; end;
if c='a' then writeln('YES') else
if c='e' then writeln('YES') else
if c='i' then writeln('YES') else
if c='u' then writeln('YES') else
if c='o' then writeln('YES') else
if c='y' then writeln('YES') else writeln('NO');
end.

var
  s : String;

function Check(c : Char) : Boolean;
begin
  if (('a' <= c) and (c <= 'z')) or (('A' <= c) and (c <= 'Z')) then
    Check := true
  else
    Check := false;
end;

begin
  ReadLn(s);
  while not Check(s[Length(s)]) do Delete(s, Length(s), 1);
  if s[Length(s)] in ['A', 'E', 'I', 'O', 'U', 'Y'] then
    WriteLn('YES')
  else
    WriteLn('NO');
end.

var
 st:string;
begin
  readln(st);
  if st[length(st)] in ['A','E','I','O','U','Y','a','e','i','o','u','y'] then writeln('YES')
    else writeln('NO');
end.

var s:string;
    t:char;
begin
  readln(s);
  while not(((s[length(s)]>='A')and(s[length(s)]<='Z'))or((s[length(s)]>='a')and(s[length(s)]<='z')))do
    delete(s,length(s),1);
  if (s[length(s)]='a')or(s[length(s)]='e')or(s[length(s)]='i')or(s[length(s)]='o')or(s[length(s)]='u')or(s[length(s)]='A')or(s[length(s)]='E')or(s[length(s)]='I')or(s[length(s)]='O')or(s[length(s)]='U')then
    writeln('YES')
  else
    writeln('NO');
end.

program Syshik;

{$APPTYPE CONSOLE}

var
s : string;
i : byte;
fl : boolean;
sym : set of char;
begin
readln (s);
sym:=[];
sym:=sym+['i']+['o']+['a']+['e']+['u']+['y'];
fl:=true;
i:=length (s);
while fl and (i>=1) do
begin
if ((ord(s [i])>=ord('a')) and (ord(s [i])<=ord('z'))) or ((ord(s [i])>=ord('A')) and (ord(s [i])<=ord('Z'))) then
begin
if s [i] in sym then write ('YES')
else write ('NO');
fl:=false;
end;
dec (i);
end;
end.

const fi = '';
        fo = '';
var
        f : text;
        i : longint;
        s : string;

begin
        assign(f,fi);
        reset(f);
        readln(f,s);
        Close(f);
        For i := 1 to length(s) do
                S[i] := upcase(s[i]);
        writeln(s);
        i := length(s);
        While  (s[i] < 'A') or (s[i] > 'Z') do
                dec(i);
        Assign(f,fo);
        rewrite(F);
        If (s[i] = 'A') or (s[i] = 'E') or (s[i] = 'I') or (s[i] = 'U') or (s[i] = 'Y') then
                Writeln(f,'YES')
        else Writeln(f,'NO');
        Close(f);
End.

var s,a,b,c:string;
    k,i,j,m,n,la,lb:integer;
    g:char;
begin
readln;
  readln(s);
  a:=s;
  n:=0;
  m:=0;
 for i:=1 to length(s) div 2 do
     if s[2*i-1]=s[2*i] then begin s[2*i-1]:='1'; s[2*i]:='0'; inc(n); end;
 for i:=1 to length(s)-1 do
     if s[i]=s[i+1] then n:=-1;
 for i:=1 to length(a) div 2 do
     if a[2*i-1]=a[2*i] then begin a[2*i-1]:='0'; a[2*i]:='1'; inc(m); end;
 for i:=1 to length(a)-1 do
     if a[i]=a[i+1] then m:=-1;
     if ((n>m)or (n<0)) and (m>0) then writeln (m);
     if ((n<m)or (m<0)) and (n>0) and not (n-1=0) then writeln (n);
     if (n=m) then writeln(n);
     end.

var
  s:string;
  i:longint;
begin
  read(s);
  for i:=length(s) downto 1 do
     if (s[i]>='A') and (s[i]<='z') then
       if s[i] in ['a','e','i','o','u','A','E','I','O','U'] then begin write('YES'); break; end
         else begin write('NO'); break; end;
END.

var s:string;
procedure sleuth;
begin
        write('YES');
        halt;
end;
begin
        read(s);
        if upcase(s[length(s)-1])='A' then sleuth
        else if upcase(s[length(s)-1])='E' then sleuth
        else if upcase(s[length(s)-1])='I' then sleuth
        else if upcase(s[length(s)-1])='O' then sleuth
        else if upcase(s[length(s)-1])='U' then sleuth
        else if upcase(s[length(s)-1])='Y' then sleuth;
        write('NO');
end.

program sleuth;
const fi='';
      fo='';
var s:string;i:longint;
begin
assign(input,fi);reset(input);
assign(output,fo);rewrite(output);
read(s);
for i:=length(s) downto 1 do
if (s[i]>='a') and (s[i]<='z') then
        begin
        if s[i] in['a','e','i','o','u','y'] then write('YES')
        else write('NO');
        break;
        end;
close(input);close(output);
end.

var
  st:string;
 begin
   readln(st);
   if (st[length(st)-1]='A') or
      (st[length(st)-1]='E') or
      (st[length(st)-1]='I') or
      (st[length(st)-1]='O') or
      (st[length(st)-1]='U') or
      (st[length(st)-1]='Y') then
      begin
        writeln('YES');
        halt;
      end;
   writeln('NO');
 end.

var
s,a,b:string;
i,j:integer;
begin
read(s);
a:='AEIOUYaeiouy';
b:='QWRTPSDFGHJKLZXCVBNMqwrtpsdfghjklzxcvbnm';
for i:=length(s) downto 1 do
if s[i]<>' ' then j:=i;
for i:=1 to length(a) do
if s[j]=a[i] then writeln('YES');
for i:=1 to length(b) do
if s[j]=b[i] then writeln('NO');

end.

const a:array[1..10]of char=('A','E','I','O','U','a','e','i','o','u');
var s:string;i,j:longint;f:boolean;
begin
  readln(s);
  for i:=length(s)downto 1 do
  begin
    if (s[i] in['A'..'Z'])or(s[i]in['a'..'z'])then
    begin
      f:=false;
      for j:=1 to 10 do
      if a[j]=s[i] then f:=true;
      if f  then writeln('YES')
      else writeln('NO');
      halt;
    end;
  end;
end.

var
	i:longint;
	st:string;
begin
	readln(st);
        upcase(st);
	for i:=length(st) downto 1 do
		if st[i] in ['A'..'Z'] then
			if (st[i]='A') or (st[i]='E') or (st[i]='I') or (st[i]='O') or (st[i]='U') or (st[i]='Y') then
			begin
				writeln('YES');
				exit;
			end else
			begin
				writeln('NO');
				exit;
			end;
end.

var s,s1,s2:string;
var i,j,n,m:longint;
x:array[1..100] of char;
begin
 readln(s);
 m:=length(s);

    while ( s[m-1]=' ') do
    begin

     m:=length(s);
     s[m-1]:=s[m-2];

       delete(s,length(s)-1,1);
          end;

    m:=length(s);
    s2:=s[m-1];

     if s[m-1] in (['a','A','e','E','i','I','o','O','u','U','y','Y'])
      then writeln('YES')
      else writeln('NO');
end.

var
	i:longint;
	st:string;
begin
	readln(st);
        upcase(st);
	for i:=length(st) downto 1 do
		if st[i] in ['a'..'z'] then
			if (st[i]='A') or (st[i]='E') or (st[i]='I') or (st[i]='O') or (st[i]='U') or (st[i]='Y') then
			begin
				writeln('YES');
				exit;
			end else
			begin
				writeln('NO');
				exit;
			end;
end.

var
 i:longint;
 s:string;
begin
 readln(s);
 for i:=length(s) downto 1 do
  begin
   if s[i] in ['a'..'z'] then begin
                               if (s[i]='a')or(s[i]='e')or(s[i]='i')or(s[i]='o')or(s[i]='u')or(s[i]='y') then writeln('YES')
                                                      else writeln('NO');
                               break;
                              end
                         else if s[i] in ['A'..'Z'] then begin
                                                          if (s[i]='A')or(s[i]='E')or(s[i]='I')or(s[i]='O')or(s[i]='U')or(s[i]='Y') then writeln('YES')
                                                                                else writeln('NO');
                                                         end
  end;
end.

program P49A;

{$APPTYPE CONSOLE}

uses
  Math, SysUtils;
var
  s: string;
  i, k: longint;
begin
  read(s);
  k := 0;
  for i := 1 to length(s) - 1 do
    if(s[i] <> ' ') then
      k := i;
  if(s[k] = 'A') or (s[k] = 'E') or (s[k] = 'I')
  or (s[k] = 'O') or (s[k] = 'U') or (s[k] = 'Y') then
    write('YES')
  else
    write('NO');
end.

var
  s : String;

function Check(c : Char) : Boolean;
begin
  if (('a' <= c) and (c <= 'z')) or (('A' <= c) and (c <= 'Z')) then
    Check := true
  else
    Check := false;
end;

begin
  ReadLn(s);
  while not Check(s[Length(s)]) do Delete(s, Length(s), 1);
  if s[Length(s)] in ['A', 'E', 'I', 'O', 'U', 'Y'] then
    WriteLn('YES')
  else
    WriteLn('NO');
end.

program sleuth;
const fi='';
      fo='';
var s:string;i:longint;
begin
assign(input,fi);reset(input);
assign(output,fo);rewrite(output);
read(s);
for i:=length(s) downto 1 do
if ((s[i]>='a') and (s[i]<='z')) or ((s[i]>='A') and (s[i]<='Z')) then
        begin
        if s[i] in['a','e','i','o','u','y'] then
                begin
                write('YES');
                continue;
                end
        else
                begin
                write('NO');
                continue;
                end;
        if s[i] in['A','E','I','O','U','Y'] then write('YES')
        else write('NO');
        break;
        end;
close(input);close(output);
end.

var
  st:string;
 begin
   readln(st);
   st:=upcase(st);
   if (st[length(st)-1]='A') or
      (st[length(st)-1]='E') or
      (st[length(st)-1]='I') or
      (st[length(st)-1]='O') or
      (st[length(st)-1]='U') or
      (st[length(st)-1]='Y') then
      begin
        writeln('YES');
        halt;
      end;
   writeln('NO');
 end.

program z;
 var
  s:string;
  l:integer;
 begin
  readln(s);
  l:=length(s);
  if (s[l-1]='a')or(s[l-1]='e')or(s[l-1]='i')or(s[l-1]='o')or(s[l-1]='u')or(s[l-1]='y')
     or(s[l-1]='A')or(s[l-1]='E')or(s[l-1]='I')or(s[l-1]='O')or
     (s[l-1]='U')or(s[l-1]='Y') then write('YES') else write('NO');
end.

var
  ca,c,d,s:string;
  i,n,ch,j,m,a,b:int64;
begin
  readln(s); ca:=' a e i o u y '; c:=' q w e r t y u i o p a s d f g h j k l z x c v b n m ';
  for i:=1 to length(s) do
    if pos(' '+lowercase(s[i])+' ',c)<>0 then d:=d+s[i];
  if length(d)=0 then writeln('NO') else
  if pos(' '+d[length(d)]+' ',ca)<>0 then writeln('YES') else writeln('NO');
end.

const z='AEIOUY';
Var i:longint;
    s:string;
Begin
       { assign(input,'input.txt');
        reset(input);
        assign(output,'output.txt');
        rewrite(output); }
        Readln(s);
        delete(s,length(s),1);
        i:=length(s);
        While s[i]=' ' do dec(i);
        if pos(s[i],z)<>0
        then writeln('YES')
        else writeln('NO');
End.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils, math;
  var n,i,m,x:longint; a,b:array [1..10000] of char; p:boolean;
begin
i:=0;
while not eoln do begin
i:=i+1;
read(a[i])
end;
p:=false;
i:=i-1;
x:=1;
while x=1 do begin
if ord(a[i])=32 then i:=i-1 else x:=2;
end;
if a[i]='A' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i]='a' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i]='I' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i]='i' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i]='O' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i]='o' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i]='U' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i]='u' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i]='Y' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if a[i]='y' then begin writeln('YES'); readln; readln; p:=true; halt(0); end;
if p=false then writeln('NO');
readln;
readln;
end.

var
  s:ansistring;
begin
  readln(s);
  if s[length(s)-1] in ['a','e','i','o','u','y','A','E','I','O','U','Y'] then
  writeln('YES') else writeln('NO');
end.

program sleuth;
var s,c:string;
i,gar:integer;
begin
 readln (s);
 gar:=length(s);
 i:=gar;
 while (s[i]=' ') or (s[i]='?') do
  begin
   dec(i);
  end;
 c:=s[i];
 if (c='a') or (c='e') or (c='i') or (c='o') or (c='u') or (c='y') then
  begin
   writeln ('YES');
  end
  else
  begin
   writeln ('NO');
  end;
end.

Var i:longint;
    s,a:string;
    f:boolean;

Begin

  a:='aeiouyAEIOUY';
  readln(s);

  f:=false;
  for i:=1 to length(a) do
   if s[length(s)-1]=a[i] then begin
                           f:=true;
                           break;
                          end;

  if f then writeln('YES') else
                           writeln('NO');

End.

{$MODE OBJFPC}
Program onlylove;
uses sysutils;
var s : ansistring;
   i : integer;
begin
  Readln(s);
  s := upcase(s);
  for i:= length(s) - 1 downto 1 do if s[i] <> ' '  then
  if s[i] in ['A', 'E', 'I','O', 'U', 'Y' ] then Writeln('YES') else
  Writeln('NO');
end.

var
  s:string;
begin
  readln(s);delete(s,length(s),1);
  s:=lowercase(s);
  if s[length(s)] in ['a','e','i','o','u','y'] then writeln('YES')
   else writeln('NO');
end.

program Syshik;

{$APPTYPE CONSOLE}

var
s : string;
sym : set of char;
begin
readln (s);
sym:=[];
sym:=sym+['i']+['o']+['a']+['e']+['u']+['y'];
if s [length(s)-1] in sym then write ('YES')
else write ('NO');
end.

program P49A;

{$APPTYPE CONSOLE}

uses
  Math, SysUtils;
var
  s: string;
  i, k: longint;
begin
  read(s);
  if(s[length(s) - 1] = 'A') or (s[length(s) - 1] = 'E') or (s[length(s) - 1] = 'I')
  or (s[length(s) - 1] = 'O') or (s[length(s) - 1] = 'U') or (s[length(s) - 1] = 'Y') then
    write('YES')
  else
    write('NO');
end.

var last, ch : char ;

begin
last := 'a';

while not seekeof do
begin
    read(ch);
    if ((ord(ch) >= ord('a')) and (ord(ch) <= ord('z'))) or((ord(ch) >= ord('A')) and (ord(ch) <= ord('Z'))) then
        last := ch;
end;
if (ord(last) >= ord('a')) and (ord(last) <= ord('z')) then
    begin
    ch := chr(ord(ch) - ord('a') + ord('A'));
    end;
if (ch = 'A') or (ch = 'E') or(ch = 'I') or(ch = 'O') or(ch = 'U') or(ch = 'Y') then write('YES')
else write('NO');

end.

var n,k,i:integer;
s,c:string;
begin
readln(s);
k:=length(s)-1;
if s[k]=' ' then begin
                 repeat
                 k:=k-1;
                 until s[k]<>' ';
                 c:=s[k];
                 end
                 else c:=s[k];

if (c='a') or (c='e') or (c='i') or (c='o') or (c='u') or (c='y') then write('YES')
else write('NO');
readln;
end.

   var
   s1:ansistring;
   s:char;
    begin
     {assign(input,'input.txt');
     assign(output,'output.txt');
     reset(input);
     rewrite(output);}
     readln(s1);
     s:=s1[length(s1)-1];
     s:= upcase(s);
     if (s='A')or(s='E')or(s='I')or(s='O')or(s='U')or(s='Y')
     then
     writeln('YES')
     else
     writeln('NO');
    end.

var s:string;
n:dword;

begin
readln(s);
if pos(s[length(s)-1], 'AEIOUYaeiouy')>1 then
  writeln('YES')
else
  writeln('NO');
end.

{$MODE OBJFPC}
Program onlylove;
uses sysutils;
var s : ansistring;
begin
  Readln(s);
  s := upcase(s);
  if s[length(s)  - 1] in ['A', 'E', 'I','O', 'U', 'Y' ] then Writeln('YES') else
  Writeln('NO');
end.

var last, ch : char ;

begin
last := 'a';

while not seekeof do
begin
    read(ch);
    if ((ord(ch) >= ord('a')) and (ord(ch) <= ord('z'))) or((ord(ch) >= ord('A')) and (ord(ch) <= ord('Z'))) then
        last := ch;
end;
writeln(last);
if (ord(last) >= ord('a')) and (ord(last) <= ord('z')) then
    begin
    last := chr(ord(last) - ord('a') + ord('A'));
    end;
writeln(last);
if (ch = 'A') or (ch = 'E') or(ch = 'I') or(ch = 'O') or(ch = 'U') or(ch = 'Y') then write('YES')
else write('NO');

end.

var
	i:longint;
	st:string;
begin
	readln(st);
        upcase(st);
	for i:=length(st) downto 1 do
		if st[i] in ['a'..'z'] then
			if (st[i]='A') or (st[i]='E') or (st[i]='I') or (st[i]='O') or (st[i]='U') or (st[i]='Y') then
			begin
				writeln('YES');
				exit;
			end else
			begin
				writeln('NO');
				exit;
			end;
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var s:string;
    n,i,x:integer;
begin
readln(s);
n:=length(s);
for i:=n downto 1 do
  if s[i] in ['a'..'z','A'..'Z'] then x:=i;
if (pos(s[x],'AEIOUY')<>0) or (pos(s[x],'aeiouy')<>0) then write('YES')
                                                      else write('NO');
end.

var a,b,c,d,e,f : longint;
s : string;
begin
readln (s);
for a := length(s) downto 1 do  begin
if (s[a]<>' ') and (s[a]<>'?') and (s[a]<>',') and (s[a]<>'.') then begin
if (s[a] = 'a') or (s[a] = 'e') or (s[a] = 'i') or (s[a] = 'o') or (s[a] = 'u') or (s[a] = 'y')
then writeln ('YES')
else writeln ('NO');
break;
end;
end;
end.

var
   cad:string[110];
   i,L:integer;
   c:set of char;
begin
  c:=['a','e','i','o','u','A','E','I','O','U'];
  readln(cad);
  L:=length(cad);
  while (cad[L]<'a') or (cad[L]>'z') do
     L:=L-1;
  if cad[L] in c then
     writeln('YES')
  ELSE
     writeln('NO');
end.

program detective;
var
 s:string[100];
begin
 read(s);
 case s[length(s)-1] of
  'a','e','i','o','u','y','A','E','I','O','U','Y':writeln('YES');
  else writeln('NO');
 end;
end.

var a:string;
    i:longint;
begin
 read(a);
 for i:=length(a) downto 1 do
  begin
   if (ord(a[i])>=65) and (ord(a[i])<=90) then
    begin
     if (a[i]='A') or (a[i]='E') or (a[i]='I') or (a[i]='O') or (a[i]='U') or (a[i]='Y')
     then
      begin
       writeln('YES');
       exit;
      end;
    end;
   if (ord(a[i])>=97) and (ord(a[i])<=122) then
   begin
    if (a[i]='a') or (a[i]='e') or (a[i]='i') or (a[i]='o') or (a[i]='u') or (a[i]='y')
    then
     begin
      writeln('YES');
      exit;
     end;
   end;
   writeln('NO');
  end;
end.

var
  s:string;
begin
  readln(s);delete(s,length(s),1);
  s:=lowercase(s);
  if s[length(s)] in ['a','e','i','o','u','y'] then writeln('YES')
   else writeln('NO');
end.

var s, gl, sogl, res: string;
i, j:integer;
c: char;
begin
readln(s);
i:=length(s) - 1;
for j:=i downto 1 do
if s[i] <> ' ' then begin c := s[i]; break; end;
c := lowcase(c);
gl := 'aeuioy';
if gl.Contains(c) then write('YES')
else write('NO');
end.

program zA;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var s,ans:string;
    i:longint;

begin
  ans:='No';
  readln(s);
  for i:=1 to length(s) do
  begin
    if s[i]in[' ','?'] then continue;
    if s[i] in ['a','e','i','o','u','y','A','E','I','O','U','Y']then ans:='YES' else ans:='No';
  end;
  writeln(ans);
end.

Var i:longint;
    s,a:string;
    f:boolean;

Begin

  a:='aeiouyAEIOUY';
  readln(s);

  f:=false;
  for i:=1 to length(a) do
   if s[length(s)-1]=a[i] then begin
                           f:=true;
                           break;
                          end;

  if f then writeln('YES') else
                           writeln('NO');

End.

var
	n, h, m, r, x, sum, y: integer;
	s, l: string;

begin

	readln(s);

	l := 'euoiayEYUIOA';
	if (pos(s[s.length - 1], l) <> 0) then
		writeln('YES');

	l := 'bcdfghjklmnpqrrstvwxzBCDFGHJKLMNPQRSTVWXZ';
	if (pos(s[s.length - 1], l) <> 0) then
		writeln('NO');

end.

var x:string;
    n,i:integer;
begin readln(x);
      n:=length(x);
      while pos(' ',x)<>0 do
      delete (x,pos(' ',x),1);
      delete(x,n,1);
      n:=length(x);
      for i:=1 to n do
      x[i]:=upcase(x[i]);
      x:=x[n];
      if (x='A')or(x='E')or(x='I')or(x='J')or(x='O')or(x='U')or(x='Y') then
      writeln('YES')
      else writeln('NO');
end.

const a:array[1..12] of char=('a','e','i','o','u','y','A','E','I','O','U','Y');
var s:string;
    I:byte;
begin
read(s);
for i:=1 to 12 do
if s[length(s)-1]=a[i] then begin write('YES'); halt; end;
write('NO');
end.

var n,k,i:integer;
s,c:string;
begin
readln(s);
k:=length(s)-1;
if s[k]=' ' then begin
                 repeat
                 k:=k-1;
                 until s[k]<>' ';
                 c:=s[k];
                 end
                 else c:=s[k];

if (c='a') or (c='e') or (c='i') or (c='o') or (c='u') or (c='y') then write('YES')
else write('NO');
readln;
end.


Last summer Peter was at his granny's in the country, when a wolf attacked sheep in the nearby forest. Now he fears to walk through the forest, to walk round the forest, even to get out of the house. He explains this not by the fear of the wolf, but by a strange, in his opinion, pattern of the forest that has n levels, where n is an even number.In the local council you were given an area map, where the granny's house is marked by point H, parts of dense forest are marked grey (see the picture to understand better).After a long time at home Peter decided to yield to his granny's persuasions and step out for a breath of fresh air. Being prudent, Peter plans the route beforehand. The route, that Peter considers the most suitable, has the following characteristics:   it starts and ends in the same place — the granny's house;  the route goes along the forest paths only (these are the segments marked black in the picture);  the route has positive length (to step out for a breath of fresh air Peter has to cover some distance anyway);  the route cannot cross itself;  there shouldn't be any part of dense forest within the part marked out by this route; You should find the amount of such suitable oriented routes modulo 1000000009.  The example of the area map for n = 12 is given in the picture. Since the map has a regular structure, you can construct it for other n by analogy using the example.

The input data contain the only even integer n (2 ≤ n ≤ 106).

Output the only number — the amount of Peter's routes modulo 1000000009.

CONST
   fin='';
   fon='';
VAR n,kq: INT64;
PROCEDURE BAT_DAU;
   BEGIN
      assign(input,fin);
      reset(input);
      assign(output,fon);
      rewrite(output);
   END;
PROCEDURE CHUONG_TRINH;
   VAR a,b,c: INT64;
   BEGIN
      readln(n);
      a:=1;
      b:=2;
      c:=4;
      while n>2 do
      begin
         c:=c*a MOD 1000000009;
         b:=(b+c) MOD 1000000009;
         a:=(a*2+3) MOD 1000000009;
         n:=n-2;
      end;
      kq:=(b*b+1)*2;
      writeln(kq MOD 1000000009);
   END;
PROCEDURE KET_THUC;
   BEGIN
      close(input);
      close(output);
   END;
BEGIN
   BAT_DAU;
   CHUONG_TRINH;
   KET_THUC;
END.

const mo=1000000009;
var n,a,b,c:int64;
begin
 read(n);a:=1;b:=2;c:=4;
 while n>2 do
  begin
   c:=c*a mod mo;b:=(b+c)mod mo;a:=(a+a+3)mod mo;dec(n,2);
  end;
 writeln((b*b+1)*2 mod mo);
end.

program ctq;
const
  ff=1000000009;
var
  n:longint;
  x,y,z,ans:int64;

begin
     //assign(input,'15E.in');reset(input);
	// assign(output,'15E.out');rewrite(output);
	 readln(n);
	 x:=1; y:=2; z:=4;
	 n:=n-2;
	 while n>0 do
	 begin
	      z:=z*x mod ff;
		  y:=(y+z) mod ff;
		  x:=(2*x+3) mod ff;
                  dec(n,2);
	 end;
	 ans:=(2*y*y+2) mod ff;
	 writeln(ans);
	 close(input);close(output);
end.

const mo=1000000009;
var
   i,n:longint;
   a,b,c:int64;

begin
   readln(n);
   a:=2;b:=2;c:=4;
   while n-2>0 do
      begin
     a:=(a*2) mod mo;
     c:=(c*(a-3)) mod mo;
     b:=(b+c) mod mo;
     n:=n-2;
      end;
   writeln(((b*b+1)*2 mod mo+mo) mod mo);
end.

Program E15;
Var
  modd,dq,ans,add,n:Int64;
Begin
  modd:=1000000009;
  dq:=1;ans:=2;add:=4;
  Readln(n);
  While (n>2) Do Begin
    add:=add*dq Mod modd;
    ans:=(ans+add) Mod modd;
    dq:=(dq*2+3) Mod modd;
    n:=n-2;
  End;
  ans:=((ans*ans+1)*2)Mod modd;
  Writeln(ans);
End.

const p=1000000009;
var
 n,a,b,c:int64;
begin
 read(n);
 a:=1;b:=2;c:=4;
 while n>2 do
  begin
   c:=c*a mod p;
   b:=(b+c)mod p;
   a:=(a*2+3)mod p;
   dec(n,2);
  end;
 writeln(2*(b*b+1)mod p);
end.

const
    maxn=1000011;
    maxm=1000000009;

var
    ans,tt:int64;
    n:longint;
    f:array[0..maxn]of int64;

procedure main;
var
    i,j:longint;
begin
    readln(n);
    f[0]:=1;
    for i:=1 to n do
        f[i]:=(2*f[i-1]+3) mod maxm;
    ans:=1; tt:=1;
    for i:=3 to n do
    begin
        if (i and 1)>0 then
            tt:=(tt*f[(i-3)>>1])mod maxm;
        ans:=(ans+tt) mod maxm;
    end;
    ans:=(4*ans*ans+1)mod maxm;
    ans:=(2*ans) mod maxm;
    writeln(ans);
end;

begin
    main;
end.

const md=1000000009;
var n,i:longint;
    d2,d:int64;
begin
  read(n);
  n:=n div 2;
  d:=1;
  for i:=3 to n do d:=(d*2+3)mod md;
  d2:=1;
  for i:=n-1 downto 1 do begin
    d2:=(1+d*(3+d2))mod md;
    d:=((d-3)*((md+1)div 2))mod md;
  end;
  writeln((4*d2+4+2*d2*d2)mod md);
end.

{$APPTYPE CONSOLE}
const md=1000000009;
var n,i:longint;
    d:array[0..1000000]of int64;
    d2:int64;
begin
  readln(n);
  n:=n div 2;
  d[2]:=1;
  for i:=3 to n do d[i]:=(d[i-1]*2+3)mod md;
  d2:=1;
  for i:=n-1 downto 1 do d2:=(1+d[i+1]*(3+d2))mod md;
  writeln((4*d2+4+2*d2*d2)mod md);
end.

{$APPTYPE CONSOLE}
type int=longint;
const md=1000000009;
var n,i:int;
    d,d2:array[0..1000000]of int64;
begin
  readln(n);
  n:=n div 2;
  d[2]:=1;
  for i:=3 to n do d[i]:=(d[i-1]*2+3)mod md;
  d2[n]:=1;
  for i:=n-1 downto 1 do d2[i]:=(1+d[i+1]*(3+d2[i+1]))mod md;
  writeln((4*d2[1]+4+2*d2[1]*d2[1])mod md);
end.

{$APPTYPE CONSOLE}
{$MAXSTACKSIZE 1000000000}
{$D+,I+,L+,Q+,R+,S+,O-,H+}
//{$D-,I-,L-,Q-,R-,S-,O+,H+}
uses
  SysUtils,Math;
type int=longint;
const md=1000000009;
var n,i:int;
    d,d2:array[0..2000000]of int64;
begin
  //reset(input,'input.txt');
  //rewrite(output,'output.txt');
  readln(n);
  n:=n div 2;
  d[2]:=1;
  for i:=3 to n do d[i]:=(d[i-1]*2+3)mod md;
  d2[n]:=1;
  for i:=n-1 downto 1 do d2[i]:=(1+d[i+1]*(3+d2[i+1]))mod md;
  writeln((4*d2[1]+4+2*d2[1]*d2[1])mod md);
end.

const md=1000000009;
var n,i:longint;
    d:array[0..500000]of longint;
    d2:int64;
begin
  read(n);
  n:=n div 2;
  d[2]:=1;
  for i:=3 to n do d[i]:=(d[i-1]*2+3)mod md;
  d2:=1;
  for i:=n-1 downto 1 do d2:=(1+d[i+1]*(3+d2))mod md;
  writeln((4*d2+4+2*d2*d2)mod md);
end.

{$R+,S+,Q+,I+,O-}
{R-,S-,Q-,I-,O+}
const md = 1000000009;
var
  f: array [0..1000010] of int64;
  n,t,i: longint;
  ans,s: int64;
begin
//  assign(input,'in'); reset(input);
//  assign(output,'out'); rewrite(output);
  read(n);
  if n >= 4 then
  begin
    t:=(n-4) div 2;
    s:=1; f[0]:=1;
    for i:=1 to t do
    begin
      f[i]:=(f[i-1]+s*4) mod md;
      s:=(s*2) mod md;
    end;
  end;
  ans:=0; s:=1;
  for i:=1 to n shr 1 do
  begin
    if i > 1 then ans:=(ans+s*f[i-2]*4) mod md
    else ans:=2;
    if i > 1 then s:=(s*f[i-2]) mod md;
  end;
  writeln((ans*ans*2+2) mod md);
  close(input);
  close(output);
end.

{$R-,S-,Q-,I-,O+}
const md = 1000000009;
var
  n,f,p,t: int64;
begin
  read(n);
  f:=1; p:=2; t:=4;
  while n > 2 do
  begin
    t:=(t*f) mod md;
    p:=(p+t) mod md;
    f:=(f*2+3) mod md;
    dec(n,2);
  end;
  writeln((p*p+1)*2 mod md);
end.

var
 a,b,i,j,k,p,n:longint;
 f,g,v,cc:array [0..500000] of longint;
 xx:extended;
function mm(x:extended):longint;
 begin
 mm:= trunc(x-trunc(x/p)*p);
 end;
function qq(x:longint):longint;
 var y:int64;
 begin
 if x=1 then
  begin
  qq:=2;
  exit;
  end;
 y:=qq( x div 2);
 y:=y*y;
 if x mod 2=1 then y:=y*2;
 qq:=mm(y);
 end;
begin
 p:=1000000009;
 f[1]:=10; f[2]:=74;
 readln(n);
 n:=n div 2;
 g[1]:=5; v[1]:=24;  cc[1]:=5;
 for i:=2 to n-2 do
  begin
  g[i]:=g[i-1]+qq(i+1);
  g[i]:=mm(g[i]);
  cc[i]:=mm(int64(cc[i-1])*g[i]);
  v[i]:=mm(int64(v[i-1])+int64(cc[i])*4);
  end;
 if n>=3 then
  begin
  xx:=mm(int64(v[n-2])*v[n-2]);
  xx:=xx+int64(v[n-2])*4;
  xx:=xx*2;
  f[n]:=mm(int64(trunc(xx))+f[1]);
  end;
 writeln(f[n]);
end.

var
 a,b,i,j,k,p,n:longint;
 f,g,v,cc,qc:array [0..500000] of int64;
 xx:int64;
function mm(x:int64):int64;
 begin
 mm:= x mod p;
 end;
function qq(x:longint):int64;
 var y:int64;
 begin
 if qc[x]<>0 then
  begin
  qq:=qc[x];
  exit;
  end;
 if x=1 then
  begin
  qq:=2;
  exit;
  end;
 y:=qq( x div 2);
 y:=y*y;
 if x mod 2=1 then y:=y*2;
 qq:=mm(y);
 qc[x]:=mm(y);
 end;
begin
 p:=1000000009;
 f[1]:=10; f[2]:=74;
 readln(n);
 n:=n div 2;
 g[1]:=5; v[1]:=24;  cc[1]:=5;
 for i:=2 to n-2 do
  begin
  g[i]:=g[i-1]+qq(i+1);
  g[i]:=mm(g[i]);
  cc[i]:=mm(cc[i-1]*g[i]);
  v[i]:=mm(v[i-1]+cc[i]*4);
  end;
 if n>=3 then
  begin
  xx:=mm(v[n-2]*v[n-2]);
  xx:=xx+v[n-2]*4;
  xx:=xx*2;
  f[n]:=mm(xx+f[1]);
  end;
 writeln(f[n]);
end.

var
 a,b,i,j,k,p,n:longint;
 f,g,v,cc,qc:array [0..500000] of extended;
 xx:extended;
function mm(x:extended):extended;
 begin
 mm:= trunc(x-trunc(x/p)*p);
 end;
function qq(x:longint):extended;
 var y:extended;
 begin
 if qc[x]<>0 then
  begin
  qq:=qc[x];
  exit;
  end;
 if x=1 then
  begin
  qq:=2;
  exit;
  end;
 y:=qq( x div 2);
 y:=y*y;
 if x mod 2=1 then y:=y*2;
 qq:=mm(y);
 qc[x]:=mm(y);
 end;
begin
 p:=1000000009;
 f[1]:=10; f[2]:=74;
 readln(n);
 n:=n div 2;
 g[1]:=5; v[1]:=24;  cc[1]:=5;
 for i:=2 to n-2 do
  begin
  g[i]:=mm(g[i-1]+qq(i+1));
  cc[i]:=mm(cc[i-1]*g[i]);
  v[i]:=mm(v[i-1]+cc[i]*4);
  end;
 if n>=3 then
  begin
  xx:=v[n-2]*v[n-2];
  xx:=xx+v[n-2]*4;
  xx:=xx*2;
  f[n]:=mm(xx+f[1]);
  end;
 writeln(f[n]:0:0);
end.

CONST
   fin='';
   fon='';
VAR n,kq: INT64;
PROCEDURE BAT_DAU;
   BEGIN
      assign(input,fin);
      reset(input);
      assign(output,fon);
      rewrite(output);
   END;
PROCEDURE CHUONG_TRINH;
   VAR a,b,c: INT64;
   BEGIN
      readln(n);
      a:=1;
      b:=2;
      c:=4;
      while n>2 do
      begin
         c:=c*a MOD 1000000009;
         b:=(b+c) MOD 1000000009;
         a:=(SQR(a)+3) MOD 1000000009;
         n:=n-2;
      end;
      kq:=(SQR(b)+1)*2;
      writeln(kq MOD 1000000009);
   END;
PROCEDURE KET_THUC;
   BEGIN
      close(input);
      close(output);
   END;
BEGIN
   BAT_DAU;
   CHUONG_TRINH;
   KET_THUC;
END.

const mo=1000000009;
var
   i,n:longint;
   a,b,c:int64;

begin
   readln(n);
   a:=2;b:=2;c:=4;
   while n>0 do
      begin
     a:=(a*2) mod mo;
     c:=(c*(a-3)) mod mo;
     b:=(b+c) mod mo;
     n:=n-2;
      end;
   writeln(((b*b+1)*2 mod mo+mo) mod mo);
end.

{$APPTYPE CONSOLE}
{$MAXSTACKSIZE 1000000000}
{$D+,I+,L+,Q+,R+,S+,O-,H+}
//{$D-,I-,L-,Q-,R-,S-,O+,H+}
uses
  SysUtils,Math;
type int=longint;
const md=1000000009;
var n,i:int;
    d,d2:array[0..2000000]of int64;
begin
 // reset(input,'input.txt');
 // rewrite(output,'output.txt');
  readln(n);
  n:=n div 2;
  d[2]:=1;
  for i:=3 to n do d[i]:=(d[i-1]+3)mod md;
  d2[n]:=1;
  for i:=n-1 downto 1 do d2[i]:=(1+d[i+1]*(3+d2[i+1]))mod md;
  writeln((4*d2[1]+4+2*d2[1]*d2[1])mod md);
end.

var
 a,b,i,j,k,p,n:longint;
 f,g,v,cc,qc:array [0..500000] of extended;
 xx:extended;
function mm(x:extended):extended;
 begin
 mm:= trunc(x-trunc(x/p)*p);
 end;
function qq(x:longint):extended;
 var y:extended;
 begin
 if qc[x]<>0 then ;
  begin
  qq:=qc[x];
  exit;
  end;
 if x=1 then
  begin
  qq:=2;
  exit;
  end;
 y:=qq( x div 2);
 y:=y*y;
 if x mod 2=1 then y:=y*2;
 qq:=mm(y);
 qc[x]:=mm(y);
 end;
begin
 p:=1000000009;
 f[1]:=10; f[2]:=74;
 readln(n);
 n:=n div 2;
 g[1]:=5; v[1]:=24;  cc[1]:=5;
 for i:=2 to n-2 do
  begin
  g[i]:=mm(g[i-1]+qq(i+1));
  cc[i]:=mm(cc[i-1]*g[i]);
  v[i]:=mm(v[i-1]+cc[i]*4);
  end;
 if n>=3 then
  begin
  xx:=v[n-2]*v[n-2];
  xx:=xx+v[n-2]*4;
  xx:=xx*2;
  f[n]:=mm(xx+f[1]);
  end;
 writeln(f[n]:0:0);
end.


Mancala is a game famous in the Middle East. It is played on a board that consists of 14 holes.   Initially, each hole has $$$a_i$$$ stones. When a player makes a move, he chooses a hole which contains a positive number of stones. He takes all the stones inside it and then redistributes these stones one by one in the next holes in a counter-clockwise direction.Note that the counter-clockwise order means if the player takes the stones from hole $$$i$$$, he will put one stone in the $$$(i+1)$$$-th hole, then in the $$$(i+2)$$$-th, etc. If he puts a stone in the $$$14$$$-th hole, the next one will be put in the first hole.After the move, the player collects all the stones from holes that contain even number of stones. The number of stones collected by player is the score, according to Resli.Resli is a famous Mancala player. He wants to know the maximum score he can obtain after one move.

The only line contains 14 integers $$$a_1, a_2, \ldots, a_{14}$$$ ($$$0 \leq a_i \leq 10^9$$$) — the number of stones in each hole. It is guaranteed that for any $$$i$$$ ($$$1\leq i \leq 14$$$) $$$a_i$$$ is either zero or odd, and there is at least one stone in the board.

Output one integer, the maximum possible score after one move.

NoteIn the first test case the board after the move from the hole with $$$7$$$ stones will look like 1 2 2 0 0 0 0 0 0 0 1 1 1 1. Then the player collects the even numbers and ends up with a score equal to $$$4$$$.

var a,b:array[0..20]of  longint ;i,j,k:longint;kc,z:int64;
begin
for i:=0 to 13 do
read (a[i]);
z:=0;
for i:=0 to 13 do
begin
if a[i] mod 2<>0 then begin
b:=a;
k:=a[i];
b[i]:=0;
for j:=0 to 13 do
b[j]:=b[j]+k div 14;
for j:=1 to k mod 14 do
inc(b[(i+j) mod 14]);
kc:=0;
for j:=0 to 13 do if b[j] mod 2<>0 then else kc:=kc+b[j];
if kc>z then z:=kc;
end;
end;
write(z);
end.

var a,b:array[0..20]of  longint ;i,j,k:longint;kc,z:int64;
begin
 for i:=0 to 13 do read (a[i]);
 z:=0;
 for i:=0 to 13 do
 begin
  if odd(a[i]) then begin
  b:=a;
  k:=a[i];
  b[i]:=0;
  for j:=0 to 13 do b[j]:=b[j]+k div 14;
  for j:=1 to k mod 14 do inc(b[(i+j) mod 14]);
  kc:=0;
  for j:=0 to 13 do if odd(b[j]) then else kc:=kc+b[j];
  if kc>z then z:=kc;
  end;
 end;
 write(z);
end.

var a:array[1..14] of int64;
i,j,k,l,m,n:int64;

function p(x:int64):int64;
var b:array[1..14] of int64;
i,j,k,l,m,n:int64;
begin
for i:=1 to 14 do
b[i]:=a[i];
k:=b[x];
b[x]:=0;
for i:=1 to 14 do b[i]+=k div 14;
k:=k mod 14;
for i:=x+1 to 14 do
if k>0 then
begin
b[i]+=1;
k-=1
end;
for i:=1 to x-1 do
if k>0 then
begin
b[i]+=1;
k-=1
end;
for i:=1 to 14 do if (b[i] mod 2=0)  then l+=b[i];
p:=l
end;
begin
for i:=1 to 14 do
read(a[i]);

for i:=1 to 14  do
if p(i)>m then m:=p(i);
write(m)
end.

var
  a, b: array[1..14] of int64;
  i, j, l, p, max: int64;

begin
  for i := 1 to 14 do read(a[i]);
  for i := 1 to 14 do
  begin
    p := 0;
    for j := 1 to 14 do b[j] := 0;
    if a[i] <> 0 then begin
      for j := 1 to 14 do
        b[j] := a[j] + (a[i] div 14);
      b[i] := a[i] div 14;
      l := a[i] - 14 * (a[i] div 14);
      for j := 1 to l do
        if ((i + j) mod 14) <> 0 then
          inc(b[(i + j) mod 14]) else inc(b[14]);
      for j := 1 to 14 do
        if (b[j] mod 2) = 0 then p := p + b[j];

    end;
    if p > max then max := p;
  end;
  writeln(max);
end.

var
  i, j, l, m, x, q: uint64;
  a: array[1..14] of uint64;
  b: array[1..14] of uint64;

begin
  for i := 1 to 14 do
    read(a[i]);
  for i := 1 to 14 do
  begin
    for j := 1 to 14 do
      b[j] := a[j];
    x := a[i];
    b[i] := 0;
    q := i;
    for j := 1 to 14 do
      b[j] := b[j] + (x div 14);
    for j := 1 to (x mod 14) do
    begin
      if q = 13 then
        q := 14
      else
        q := (q + 1) mod 14;
      b[q] := b[q] + 1;
    end;
    l := 0;
    for j := 1 to 14 do
      if b[j] mod 2 = 0 then
        l := l + b[j];
    if l > m then
      m := l;
  end;
  write(m);
end.

var  a,b:array[1..14]of integer;
     m,p:BigInteger;
begin
for var i:integer:=1 to 14 do Read(a[i]);
for var i:integer:=1 to 14 do begin
     b:=a;
     p:=0;
     var k:integer:=b[i] div 14;
     b[i]:=b[i] mod 14;
     for var j:integer:=i+1 to Min(14,i+b[i]) do Inc(b[j]);
     for var j:integer:=1 to Max(0,i+b[i]-14) do Inc(b[j]);
     b[i]:=0;
     for var j:integer:=1 to 14 do Inc(b[j],k);
     for var j:integer:=1 to 14 do
          if (b[j] mod 2 = 0) then p:=p+b[j];
     if (p>m) then m:=p;
end;
Writeln(m);
end.

var i, j, k, x, m: uint64;
    a, f: array [1..14] of uint64;
Begin;
 for i:=1 to 14 do begin;
  read (f[i]);
 end;
 for i:=1 to 14 do begin;
  for j:=1 to 14 do begin;
   a[j]:=f[j];
  end;
  if a[i]=0 then continue;
  x:=a[i];
  a[i]:=0;
  for j:=1 to 14 do begin;
   a[j]:=a[j]+(x div 14);
  end;
  j:=i+1;
  k:=i+1;
  while (j<=i+(x mod 14)) do begin;
   if k>14 then k:=1;
   a[k]:=a[k]+1;
   j:=j+1;
   k:=k+1;
  end;
  k:=0;
  for j:=1 to 14 do begin;
   if (a[j] mod 2)=0 then k:=k+a[j];
  end;
  //writeln (k, ' ', m);
  if k>m then m:=k;
  j:=0;
  k:=0;
 end;
 write (m);
end.

           const eps=0.00000001;  besk1=200000008;  nn=200000;
   besk=8000000000000000000;
   label 1,2,3,4;
    type    real=extended;  {string=ansistring;}
    mas=array [-10..nn] of int64;   point=record x,y,z:real;end;
    zap=record p1,p2,p3 :int64;end; zap1=^zap;
    mass=array[0..nn] of longint;mass1=^mass;
    var ot,aa,bb,cc,p1,p2,p3,p4,k,kk,znamzz,kolperiod,znam,tperiod,start,finish,kol1,kol2,lavel,time,x0,modul,pos,p0,t2,t1,jj,w,ii,ogr,q,p,pp,tt,oldtt,qq,qq1,qq2,q1,q2,pmax,imax,t,nm,n,m,s,smin,cen,dl,i1:int64;
   step1, step, i,j:longint;
    ppp,prob1,prob2,prob3,pr1new,pr2new,pr3new,pr1,pr2,pr3:zap;
    vv,znak,ll:int64;
    name,d,dnew, voltay,pos1,pos2,l,r,c,z,y,x,day,b,a:array[-200000..1600000] of int64;
    zz:array[0..125000000] of byte;
    gr,pole:array[-10..1002,-10..1005] of char;
    ddd,dd1,dd2,dd3,dd4,dd,ddsum:array[-10..1101,-10..1010] of int64;
   zanx,zany:array[-10..2000000] of boolean;
    sss1,sss2:string;
    newnabor,stoim,nabor:array[-10..200005] of int64;
     zan,fl:array[-100..10000000] of boolean;
    ss1,ss2,ss:string;ch,ch1,ch2:char;
    s2,s1:array[-100..200000] of string;
    grr :array [-10..2010,-10..2010] of boolean;
    maxpr:array[0..nn] of string;
    sss:array[-10..nn] of string;
     distmax,vel,rr,x1,y1,yy,ott,v0,v1,s0,t0:extended;
     zv:point;
     dll,xx,temp,sumtemp,vol,newx,newy:array[-10..200000] of extended;
     ottt,aaa,bbb,ccc:extended;
     xxx,yyy,yot:double;
       flag2,flag,flag1:boolean;

      function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

     function summ(xx,yy:zap):zap1;
var t1,t2,tt:int64; ott:zap;
 begin
    t1:=(xx.p1*yy.p2+xx.p2*yy.p1) mod modul;
    t2:=(xx.p2*yy.p2) mod modul;
    tt:=nod(t1,t2);
    t1:=t1 div tt mod modul;
    t2:=t2 div tt mod modul;
    ott.p1:=t1; ott.p2:=t2;

   summ:=@ott;
 end;

     function prod(xx,yy:zap):zap1;
var t1,t2,tt:int64; ott:zap;
 begin
    t1:=(xx.p1*yy.p1) mod modul;
    t2:=(xx.p2*yy.p2) mod modul;
    tt:=nod(t1,t2);
    t1:=(t1 div tt) mod modul;
    t2:=(t2 div tt) mod modul;
    ott.p1:=t1; ott.p2:=t2;

   prod:=@ott;
 end;

    function al(x,y:real):real; var t0,t1,p,s0,s1:real;
 begin
     if (x>0)and(y>=0) then p:=arctan(y/x);
     if x<0 then p:=pi+arctan(y/x);
     if(x>0)and(y<0) then p:=2*pi+arctan(y/x);
     if x=0 then if (y>=0) then p:=pi/2 else p:=3*pi/2;
     al:=p{/pi*180};
 end;
  function min(x,y:int64):int64;begin min:=x;if y<x then min:=y; end;
  function max(x,y:int64):int64;begin max:=x;if y>x then max:=y; end;

function degg(a,k:int64):int64; var p:int64;
begin
 if k<=0 then degg:=1 else if odd(k) then degg:=degg(a,k-1)*a mod modul else
   begin  p:=degg(a,k shr 1); degg:=p*p mod modul;   end;

end;

function prost(tt:longint):boolean;
var aa:extended; i,p,t:longint;  fl:boolean;
 begin
   fl:=true;
   aa:=tt;
   aa:=sqrt(aa);
   t:=round(aa);
   for i:=2 to t do if tt mod i=0 then fl:=false;

   prost:=fl;
 end;

function arcsin(pp:extended):extended;
var tt:extended;
begin
   if (abs(pp)<=1+eps)and (abs(pp)>=1-eps)
   then if pp>0 then arcsin:=pi/2 else arcsin:=-pi/2;
   tt:=1-pp*pp;
   if abs(tt)>=0 then
     begin
        arcsin:=arctan(pp/sqrt(tt));

     end;

end;

begin

   { assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
    }
      n:=14;
      for i:=0 to 13 do read(a[i]);
      for step:=0 to 13 do if odd(a[step]) then
        begin
           p1:=a[step] div 14;
           p2:=a[step] mod 14;
         {  writeln('step= ',step);
         }  for i:=0 to 13 do if i<>step then x[i]:=a[i];
           x[step]:=0;
           for i:=0 to 13 do x[i]:=x[i]+p1;
           t:=step+p2;
           for i:=step+1 to step+p2 do
             begin
                ii:=i mod 14;
                inc(x[ii]);
             end;

         { for i:=0 to 13 do write(x[i],' '); writeln;
         } p:=0;
          for i:=0 to 13 do if not odd(x[i]) then p:=p+x[i];
         { writeln('p= ',p);
         } ot:=max(ot,p)

        end;

        writeln(ot);

   1:          close(output);
end.

uses math;
var a,org:array[1..14] of longint;
procedure distribute(n:longint);
var i,t,ext:longint;
begin
    t:=a[n];
    ext:=t div 14;
    a[n]:=0;
    for i:=1 to 14 do
        a[i]:=a[i]+ext;
    t:=t mod 14;
    i:=n;
    while (t>0) do
    begin
        inc(i);
        if (i>14) then i:=1;
        inc(a[i]);
        dec(t);
    end;
end;
function collect:int64;
var i:longint;
    s:int64;
begin
    s:=0;
    for i:=1 to 14 do
        if (a[i] mod 2=0) then
            s:=s+a[i];
    exit(s);
end;
procedure enter;
var i:longint;
begin
    for i:=1 to 14 do
        read(org[i]);
end;
procedure solve;
var i,j:longint;
    s:int64;
begin
    enter;
    s:=0;
    for i:=1 to 14 do
    begin
        for j:=1 to 14 do
            a[j]:=org[j];
        distribute(i);
        s:=max(collect,s);
    end;
    write(s);
end;
begin
    solve;
end.

uses math;

var
  a,b:array[0..14] of int64;

procedure pread;
  var fi:text; i:longint;
  begin
    assign(fi,'');reset(fi);
    for i:=1 to 14 do
      read(fi,a[i]);
    close(fi);
  end;

procedure pp;
  var i,j:longint; res,tmp,m:int64;
  begin
    res:=0;
    for i:=1 to 14 do begin
      b:=a;
      tmp:=a[i] div 14;
      m:=a[i] mod 14;
      b[i]:=0;
      for j:=1 to 14 do
        inc(b[j],tmp);
      j:=i;
      while m>0 do begin
        inc(j);
        if j>14 then j:=1;
        inc(b[j]);
        dec(m);
      end;

      tmp:=0;
      for j:=1 to 14 do
        if b[j] mod 2=0 then
          inc(tmp,b[j]);
      res:=max(res,tmp);
    end;
    write(res);
  end;

begin
  pread;
  pp;
end.

var i,j,r,c:longint;
max,p:int64;
a,b:array[1..20] of longint;

begin
//assign(input,'mkl.in');reset(input);
//assign(output,'mkl.out');rewrite(output);
for i:=1 to 14 do
  read(a[i]);
b:=a;
for i:=1 to 14 do
  begin
  for j:=i+1 to 14 do
    begin
    if a[i]=0 then break;
    a[j]:=a[j]+1;
    a[i]:=a[i]-1;
    end;
  r:=a[i] div 14;
  c:=a[i] mod 14;
  a[i]:=0;
  for j:=1 to 14 do
    a[j]:=a[j]+r;
  for j:=1 to 14 do
    begin
    if c=0 then break;
    a[j]:=a[j]+1;
    c:=c-1;
    end;
  p:=0;
  for j:=1 to 14 do
    if a[j] mod 2=0 then p:=p+a[j];
  if p>max then max:=p;
  a:=b;
  end;
write(max);
close(input);
close(output);
end.

var n,i,j:longint;
    a,b:array[0..50]of int64;
    ans,max:int64;
begin
  n:=14;
  ans:=0;
  max:=0;
  for i:=1 to n do
  read(a[i]);
  for i:=1 to n do
  if a[i]>0 then
  begin
    for j:=1 to n do
    if i<>j then b[j]:=a[j]+a[i] div n;
    b[i]:=a[i] div n;
    for j:=i+1 to i+a[i] mod n do
    begin
      if j>n then break;
      inc(b[j]);
    end;
    for j:=1 to i+a[i] mod n-n do
    inc(b[j]);
    for j:=1 to n do
    if b[j] mod 2=0 then inc(ans,b[j]);
    if ans>max then max:=ans;
    ans:=0;
    for j:=1 to n do
    b[j]:=0;

  end;
  writeln(max);
end.

var n, i, j : longint;
    a, b : array[0..50] of int64;
    ans, mx : int64;

begin
    n := 14; ans := 0; mx := 0;
    for i := 1 to n do read(a[i]);
    for i := 1 to n do
    if (a[i] > 0) then
    begin
        for j := 1 to n do
        if (i <> j) then b[j] := a[j] + a[i] div n;
        b[i] := a[i] div n;
        for j := i + 1 to i + a[i] mod n do
        begin
            if (j > n) then break;
            inc(b[j]);
        end;
        for j := 1 to i + a[i] mod n - n do inc(b[j]);
        for j := 1 to n do
        if (b[j] mod 2 = 0) then inc(ans, b[j]);
        if (ans > mx) then mx := ans;
        ans := 0;
        for j := 1 to n do b[j] := 0;
    end;
    writeln(mx);
end.

Const fi='';
      fo='';
Var f:text;
    a,b:array[1..100]of longint;
    so1,tmp,tmp1,tam:longint;
    x,i,j:byte;
    kq,max:int64;
Procedure doc;
Begin
        Assign(f,fi);
        Reset(f);
        For i:=1 to 14 do
         Read(f,a[i]);
        Close(f);
End;
Procedure xuli;
Begin
kq:=0;
max:=low(longint);
 {for i:=1 to 14 do
  if a[i] mod 2=0 then kq:=kq+a[i];
 if kq>max then kq:=max; }

        FOr i:=1 to 14 do

           begin
          b:=a;
          tam:=i;
          so1:=b[tam];
          b[tam]:=0;
           tmp:= so1 mod 14 ;
           tmp1:=so1 div 14;
           if tmp1<>0 then
           for x:=1 to 14 do
            inc(b[x],tmp1);

          while tmp>0 do
           begin
             inc(tam);
             if tam=15 then tam:=1;
             dec(tmp) ;
            inc(b[tam]);
           end;
           kq:=0;
        for j:=1 to 14 do
         if b[j] mod 2=0 then kq:=kq+b[j];
          if kq>max then max:=kq;
         end;

end;

Procedure xuat;
Begin
        Assign(f,fo);
        Rewrite(f);
        Write(f,max);
        Close(F);
End;

Begin
doc;
xuli;
xuat;
End.

//abcdefghijklmnopqrstuvwxyz
var
a,b:array [0..13] of longint;
c,d,i,j:longint;
w,ans:int64;
begin
for i:=0 to 13 do read(a[i]);
for i:=0 to 13 do
  begin
  b:=a;
  c:=a[i];
  b[i]:=0;
  d:=c mod 14;
  c:=c div 14;
  for j:=1 to d do
    inc(b[(i+j) mod 14],c+1);
  for j:=d+1 to 14 do
    inc(b[(i+j) mod 14],c);
  w:=0;
  for j:=0 to 13 do
    if b[j] mod 2=0 then w:=w+b[j];
  if w>ans then ans:=w;
  end;
writeln(ans);
end.

 var i,j:longint;
  sum,ans:int64;
  a,b:array [1..14] of int64;
  begin
  for i:=1 to 14 do
   read (a[i]);

  for i:=1 to 14 do

    if a[i]<>0 then
     begin
      sum:=0;
      for j:=1 to 14 do
       b[j]:=a[j]+a[i] div 14;

       b[i]:=b[i]-a[i];

      for j:=i+1 to a[i] mod 14+i do
       begin
        if j>14 then inc (b[j-14])
                else inc (b[j]);
       end;

      for j:=1 to 14 do
       if b[j] mod 2 = 0 then sum:=sum+b[j];

      if sum>ans then ans:=sum;
     end;

  writeln (ans);

  end.

var a,b:array[0..20]of  longint ;i,j,k:longint;kc,z:int64;
begin
 for i:=0 to 13 do read (a[i]);
 z:=0;
 for i:=0 to 13 do
 begin
  if odd(a[i]) then begin
  b:=a;
  k:=a[i];
  for j:=0 to 13 do b[j]:=b[j]+k div 14;
  for j:=1 to k mod 14 do inc(b[(i+j) mod 14]);
  kc:=0;
  for j:=0 to 13 do if odd(b[j]) then else kc:=kc+b[j];
  if kc>z then z:=kc;
  end;
 end;
 write(z);
end.

var a,b:array[0..20]of longint;i,j,k,z:longint;
begin
 for i:=0 to 13 do read (a[i]);
 z:=0;
 for i:=0 to 13 do
 begin
  if odd(a[i]) then begin
  b:=a;
  k:=a[i];
  for j:=0 to 14 do b[j]:=b[j]+k div 14;
  for j:=1 to k mod 14 do inc(b[(i+j) mod 14]);
  k:=0;
  for j:=0 to 13 do if odd(b[j]) then else k:=k+b[j];
  if k>z then z:=k;
  end;
 end;
 write(z);
end.

var a:array[1..14] of int64;
i,j,k,l,m,n:int64;

function p(x:longint):longint;
var b:array[1..14] of int64;
i,j,k,l,m,n:int64;
begin
for i:=1 to 14 do
b[i]:=a[i];
k:=b[x];
b[x]:=0;
for i:=1 to 14 do b[i]+=k div 14;
k:=k mod 14;
for i:=x+1 to 14 do
if k>0 then
begin
b[i]+=1;
k-=1
end;
for i:=1 to x-1 do
if k>0 then
begin
b[i]+=1;
k-=1
end;
for i:=1 to 14 do if (b[i] mod 2=0)  then l+=b[i];
p:=l
end;
begin
for i:=1 to 14 do
read(a[i]);

for i:=1 to 14  do
if p(i)>m then m:=p(i);
write(m)
end.

var  a,b:array[1..14]of integer;
     m,p:integer;
begin
for var i:integer:=1 to 14 do Read(a[i]);
for var i:integer:=1 to 14 do begin
     b:=a;
     p:=0;
     var k:integer:=b[i] div 14;
     b[i]:=b[i] mod 14;
     for var j:integer:=i+1 to Min(14,i+b[i]) do Inc(b[j]);
     for var j:integer:=1 to Max(0,i+b[i]-14) do Inc(b[j]);
     b[i]:=0;
     for var j:integer:=1 to 14 do Inc(b[j],k);
     for var j:integer:=1 to 14 do
          if (b[j] mod 2 = 0) then Inc(p,b[j]);
     if (p>m) then m:=p;
end;
Writeln(m);
end.

var i, j, k, x, m: uint64;
    a, f: array [1..14] of uint64;
Begin;
 for i:=1 to 14 do begin;
  read (f[i]);
 end;
 for i:=1 to 14 do begin;
  for j:=1 to 14 do begin;
   a[j]:=f[j];
  end;
  if a[i]=0 then continue;
  x:=a[i];
  a[i]:=0;
  for j:=1 to 14 do begin;
   a[j]:=a[j]+(x div 14);
  end;
  j:=i+1;
  k:=i+1;
  while (j<=i+(x mod 14)) do begin;
   if k>14 then k:=1;
   a[k]:=a[k]+1;
   j:=j+1;
   k:=k+1;
  end;
  k:=0;
  for j:=1 to 14 do begin;
   if (a[j] mod 2)=0 then k:=k+a[j];
  end;
  writeln (k, ' ', m);
  if k>m then m:=k;
  j:=0;
  k:=0;
 end;
 write (m);
end.

var i, j, k, x, m: uint64;
    a, f: array [1..14] of uint64;
Begin;
 for i:=1 to 14 do begin;
  read (f[i]);
 end;
 for i:=1 to 14 do begin;
  for j:=1 to 14 do begin;
   a[j]:=f[j];
  end;
  if a[i]=0 then continue;
  x:=a[i];
  for j:=1 to 14 do begin;
   a[j]:=a[j]+(x div 14);
  end;
  j:=i+1;
  k:=i+1;
  while (j<=i+(x mod 14)) do begin;
   if k>14 then k:=1;
   a[k]:=a[k]+1;
   j:=j+1;
   k:=k+1;
  end;
  k:=0;
  for j:=1 to 14 do begin;
   if (a[j] mod 2)=0 then k:=k+a[j];
  end;
  if k>m then m:=k;
  j:=0;
  k:=0;
 end;
 write (m);
end.

uses math;
var a,org:array[1..14] of longint;
procedure distribute(n:longint);
var i,t,ext:longint;
begin
    t:=a[n];
    writeln(n,' ',t);
    ext:=t div 14;
    a[n]:=0;
    for i:=1 to 14 do
        a[i]:=a[i]+ext;
    t:=t mod 14;
    i:=n;
    while (t>0) do
    begin
        inc(i);
        if (i>14) then i:=1;
        inc(a[i]);
        dec(t);
    end;
end;
function collect:int64;
var i:longint;
    s:int64;
begin
    s:=0;
    for i:=1 to 14 do
        if (a[i] mod 2=0) then
            s:=s+a[i];
    exit(s);
end;
procedure enter;
var i:longint;
begin
    for i:=1 to 14 do
        read(org[i]);
end;
procedure solve;
var i,j:longint;
    s:int64;
begin
    enter;
    s:=0;
    for i:=1 to 14 do
    begin
        for j:=1 to 14 do
            a[j]:=org[j];
        distribute(i);
        s:=max(collect,s);
    end;
    write(s);
end;
begin
    solve;
end.

uses math;

var
  a,b:array[0..14] of int64;

procedure pread;
  var fi:text; i:longint;
  begin
    assign(fi,'');reset(fi);
    for i:=1 to 14 do
      read(fi,a[i]);
    close(fi);
  end;

procedure pp;
  var i,j,tmp,res,m:longint;
  begin
    res:=0;
    for i:=1 to 14 do begin
      b:=a;
      tmp:=a[i] div 14;
      m:=a[i] mod 14;
      b[i]:=0;
      for j:=1 to 14 do
        inc(b[j],tmp);
      j:=i;
      while m>0 do begin
        inc(j);
        if j>14 then j:=1;
        inc(b[j]);
        dec(m);
      end;

      tmp:=0;
      for j:=1 to 14 do
        if b[j] mod 2=0 then
          inc(tmp,b[j]);
      res:=max(res,tmp);
    end;
    write(res);
  end;

begin
  pread;
  pp;
end.

var i,t,x,j,max,s:longint;
a,b:array[0..1001] of longint;
begin
//assign(input,'mkl.in');reset(input);
//assign(output,'mkl.out');rewrite(output);
for i:=1 to 14 do
  read(a[i]);
for i:=1 to 14 do
  begin
  b:=a;x:=a[i];
  t:=i+1;
  while x<>0 do
    begin
    b[t]:=b[t]+1;
    t:=t+1;
    if t>14 then t:=1;
    x:=x-1;
    end;
  s:=0;
  for j:=1 to 14 do
    if b[j] mod 2=0 then
      s:=s+b[j];
  if s>max then max:=s;
  end;
writeln(max);
close(input);close(output);
end.

 var i,j:longint;
  sum,ans:int64;
  a,b:array [1..14] of int64;
  begin
  for i:=1 to 14 do
   read (a[i]);

  for i:=1 to 14 do

    if a[i]<>0 then
     begin
      sum:=0;
      for j:=1 to 14 do
       b[j]:=a[j]+a[i] div 14;

       b[i]:=b[i]-a[i];

      for j:=i+1 to a[i] mod 14+i+1 do
       begin
        if j>14 then inc (b[j-14])
                else inc (b[j]);
       end;

      for j:=1 to 14 do
       if b[j] mod 2 = 0 then sum:=sum+b[j];

      if sum>ans then ans:=sum;
     end;

  writeln (ans);

  end.