//package ecr107;

import java.io.*;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Queue;

public class F {
	InputStream is;
	FastWriter out;
	String INPUT = "";

	void solve()
	{
		int n = ni(), m = ni();
		char[][] ss = new char[n][];
		String[] oss = new String[n];
		for(int i = 0;i < n;i++){
			ss[i] = ns().toCharArray();
			oss[i] = new String(ss[i]);
		}
		int[] offset = new int[n+1];
		offset[0] = 1;
		for(int i = 0;i < n;i++){
			offset[i+1] = offset[i] + ss[i].length-1;
		}
		int U = offset[n]-1;

		final int D = 5;
		int[][] M = new int[(2*U+1)*D][(2*U+1)*D];
//		tr(offset);
		for(int i = 0;i < 2*U+1;i++){
			int lb, of;
			if(i == 0) {
				lb = 0;
				of = 0;
			}else if(i < U+1) {
				lb = lowerBound(offset, i+1) - 1;
				of = i-offset[lb] + 1;
			}else {
				lb = lowerBound(offset, i-U + 1) - 1;
				of = i - U - offset[lb] + 1;
			}
//			tr(i, lb, of, U);

			if(i == 0){
				for(int j = 0;j < n;j++){
					for(int k = 0;k < n;k++){
						if(k != j && oss[k].startsWith(oss[j])){
							M[offset[k]+ss[j].length-1][0+(2*U+1)*(ss[j].length-1)] = 1;
							M[offset[k]+U+ss[j].length-1][0+(2*U+1)*(ss[j].length-1)] = 1;
						}
					}
					M[0][0+(2*U+1)*(ss[j].length-1)] += 1;
				}
			}else if(i < U+1){
				// r: 0 -> 0
				for(int j = 0;j < n;j++){
					if(oss[lb].substring(of).equals(oss[j])){
						M[0][i+(2*U+1)*(oss[j].length()-1)] += 1;
					}else if(oss[lb].substring(of).startsWith(oss[j])){
						M[i+oss[j].length()][i+(2*U+1)*(oss[j].length()-1)] += 1;
					}
				}
				// l: -> 0
				String suf = oss[lb].substring(of);
				for(int j = 0;j < n;j++){
					if(oss[j].startsWith(suf) && !oss[j].equals(suf)){
						M[U+offset[j]+suf.length()-1][i+(2*U+1)*(suf.length()-1)] += 1;
					}
				}
			}else{
				// l: 0 -> 0
				for(int j = 0;j < n;j++){
					if(oss[lb].substring(of).equals(oss[j])){
						M[0][i+(2*U+1)*(oss[j].length()-1)] += 1;
					}else if(oss[lb].substring(of).startsWith(oss[j])){
						M[i+oss[j].length()][i+(2*U+1)*(oss[j].length()-1)] += 1;
					}
				}
				// r: -> 0
				String suf = oss[lb].substring(of);
				for(int j = 0;j < n;j++){
					if(oss[j].startsWith(suf) && !oss[j].equals(suf)){
						M[offset[j]+suf.length()-1][i+(2*U+1)*(suf.length()-1)] += 1;
					}
				}
			}
		}
		for(int i = 0;i < 2*U+1;i++){
			for(int j = 0;j < D-1;j++){
				M[i+(2*U+1)*(j+1)][i+(2*U+1)*j] = 1;
			}
		}

//		for(int[] row : M){
//			tr(row);
//		}

		int[] v = new int[(2*U+1)*D];
		v[0] = 1;
		v = pow(M, v, m);
//		for(int i = 1;i < U+1;i++){
//			if(v[i] != v[i+U]){
//				tr("diff", i, i+U, v[i], v[i+U]);
//			}
//		}
//		tr(v);
		out.println(v[0]);
	}

	///////// begin
	public static final int mod = 998244353;
	public static final long m2 = (long)mod*mod;
	public static final long BIG = 8L*m2;

	// A^e*v
	public static int[] pow(int[][] A, int[] v, long e)
	{
		for(int i = 0;i < v.length;i++){
			if(v[i] >= mod)v[i] %= mod;
		}
		int[][] MUL = A;
		for(;e > 0;e>>>=1) {
			if((e&1)==1)v = mul(MUL, v);
			MUL = p2(MUL);
		}
		return v;
	}

	// int matrix*int vector
	public static int[] mul(int[][] A, int[] v)
	{
		int m = A.length;
		int n = v.length;
		int[] w = new int[m];
		for(int i = 0;i < m;i++){
			long sum = 0;
			for(int k = 0;k < n;k++){
				sum += (long)A[i][k] * v[k];
				if(sum >= BIG)sum -= BIG;
			}
			w[i] = (int)(sum % mod);
		}
		return w;
	}

	// int matrix^2 (be careful about negative value)
	public static int[][] p2(int[][] A)
	{
		int n = A.length;
		int[][] C = new int[n][n];
		for(int i = 0;i < n;i++){
			long[] sum = new long[n];
			for(int k = 0;k < n;k++){
				for(int j = 0;j < n;j++){
					sum[j] += (long)A[i][k] * A[k][j];
					if(sum[j] >= BIG)sum[j] -= BIG;
				}
			}
			for(int j = 0;j < n;j++){
				C[i][j] = (int)(sum[j] % mod);
			}
		}
		return C;
	}

	public static int lowerBound(int[] a, int v){ return lowerBound(a, 0, a.length, v); }
	public static int lowerBound(int[] a, int l, int r, int v)
	{
		if(l > r || l < 0 || r > a.length)throw new IllegalArgumentException();
		int low = l-1, high = r;
		while(high-low > 1){
			int h = high+low>>>1;
			if(a[h] >= v){
				high = h;
			}else{
				low = h;
			}
		}
		return high;
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new FastWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception { new F().run(); }

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private long[] nal(int n)
	{
		long[] a = new long[n];
		for(int i = 0;i < n;i++)a[i] = nl();
		return a;
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[][] nmi(int n, int m) {
		int[][] map = new int[n][];
		for(int i = 0;i < n;i++)map[i] = na(m);
		return map;
	}

	private int ni() { return (int)nl(); }

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	public static class FastWriter
	{
		private static final int BUF_SIZE = 1<<13;
		private final byte[] buf = new byte[BUF_SIZE];
		private final OutputStream out;
		private int ptr = 0;

		private FastWriter(){out = null;}

		public FastWriter(OutputStream os)
		{
			this.out = os;
		}

		public FastWriter(String path)
		{
			try {
				this.out = new FileOutputStream(path);
			} catch (FileNotFoundException e) {
				throw new RuntimeException("FastWriter");
			}
		}

		public FastWriter write(byte b)
		{
			buf[ptr++] = b;
			if(ptr == BUF_SIZE)innerflush();
			return this;
		}

		public FastWriter write(char c)
		{
			return write((byte)c);
		}

		public FastWriter write(char[] s)
		{
			for(char c : s){
				buf[ptr++] = (byte)c;
				if(ptr == BUF_SIZE)innerflush();
			}
			return this;
		}

		public FastWriter write(String s)
		{
			s.chars().forEach(c -> {
				buf[ptr++] = (byte)c;
				if(ptr == BUF_SIZE)innerflush();
			});
			return this;
		}

		private static int countDigits(int l) {
			if (l >= 1000000000) return 10;
			if (l >= 100000000) return 9;
			if (l >= 10000000) return 8;
			if (l >= 1000000) return 7;
			if (l >= 100000) return 6;
			if (l >= 10000) return 5;
			if (l >= 1000) return 4;
			if (l >= 100) return 3;
			if (l >= 10) return 2;
			return 1;
		}

		public FastWriter write(int x)
		{
			if(x == Integer.MIN_VALUE){
				return write((long)x);
			}
			if(ptr + 12 >= BUF_SIZE)innerflush();
			if(x < 0){
				write((byte)'-');
				x = -x;
			}
			int d = countDigits(x);
			for(int i = ptr + d - 1;i >= ptr;i--){
				buf[i] = (byte)('0'+x%10);
				x /= 10;
			}
			ptr += d;
			return this;
		}

		private static int countDigits(long l) {
			if (l >= 1000000000000000000L) return 19;
			if (l >= 100000000000000000L) return 18;
			if (l >= 10000000000000000L) return 17;
			if (l >= 1000000000000000L) return 16;
			if (l >= 100000000000000L) return 15;
			if (l >= 10000000000000L) return 14;
			if (l >= 1000000000000L) return 13;
			if (l >= 100000000000L) return 12;
			if (l >= 10000000000L) return 11;
			if (l >= 1000000000L) return 10;
			if (l >= 100000000L) return 9;
			if (l >= 10000000L) return 8;
			if (l >= 1000000L) return 7;
			if (l >= 100000L) return 6;
			if (l >= 10000L) return 5;
			if (l >= 1000L) return 4;
			if (l >= 100L) return 3;
			if (l >= 10L) return 2;
			return 1;
		}

		public FastWriter write(long x)
		{
			if(x == Long.MIN_VALUE){
				return write("" + x);
			}
			if(ptr + 21 >= BUF_SIZE)innerflush();
			if(x < 0){
				write((byte)'-');
				x = -x;
			}
			int d = countDigits(x);
			for(int i = ptr + d - 1;i >= ptr;i--){
				buf[i] = (byte)('0'+x%10);
				x /= 10;
			}
			ptr += d;
			return this;
		}

		public FastWriter write(double x, int precision)
		{
			if(x < 0){
				write('-');
				x = -x;
			}
			x += Math.pow(10, -precision)/2;
			//		if(x < 0){ x = 0; }
			write((long)x).write(".");
			x -= (long)x;
			for(int i = 0;i < precision;i++){
				x *= 10;
				write((char)('0'+(int)x));
				x -= (int)x;
			}
			return this;
		}

		public FastWriter writeln(char c){
			return write(c).writeln();
		}

		public FastWriter writeln(int x){
			return write(x).writeln();
		}

		public FastWriter writeln(long x){
			return write(x).writeln();
		}

		public FastWriter writeln(double x, int precision){
			return write(x, precision).writeln();
		}

		public FastWriter write(int... xs)
		{
			boolean first = true;
			for(int x : xs) {
				if (!first) write(' ');
				first = false;
				write(x);
			}
			return this;
		}

		public FastWriter write(long... xs)
		{
			boolean first = true;
			for(long x : xs) {
				if (!first) write(' ');
				first = false;
				write(x);
			}
			return this;
		}

		public FastWriter writeln()
		{
			return write((byte)'\n');
		}

		public FastWriter writeln(int... xs)
		{
			return write(xs).writeln();
		}

		public FastWriter writeln(long... xs)
		{
			return write(xs).writeln();
		}

		public FastWriter writeln(char[] line)
		{
			return write(line).writeln();
		}

		public FastWriter writeln(char[]... map)
		{
			for(char[] line : map)write(line).writeln();
			return this;
		}

		public FastWriter writeln(String s)
		{
			return write(s).writeln();
		}

		private void innerflush()
		{
			try {
				out.write(buf, 0, ptr);
				ptr = 0;
			} catch (IOException e) {
				throw new RuntimeException("innerflush");
			}
		}

		public void flush()
		{
			innerflush();
			try {
				out.flush();
			} catch (IOException e) {
				throw new RuntimeException("flush");
			}
		}

		public FastWriter print(byte b) { return write(b); }
		public FastWriter print(char c) { return write(c); }
		public FastWriter print(char[] s) { return write(s); }
		public FastWriter print(String s) { return write(s); }
		public FastWriter print(int x) { return write(x); }
		public FastWriter print(long x) { return write(x); }
		public FastWriter print(double x, int precision) { return write(x, precision); }
		public FastWriter println(char c){ return writeln(c); }
		public FastWriter println(int x){ return writeln(x); }
		public FastWriter println(long x){ return writeln(x); }
		public FastWriter println(double x, int precision){ return writeln(x, precision); }
		public FastWriter print(int... xs) { return write(xs); }
		public FastWriter print(long... xs) { return write(xs); }
		public FastWriter println(int... xs) { return writeln(xs); }
		public FastWriter println(long... xs) { return writeln(xs); }
		public FastWriter println(char[] line) { return writeln(line); }
		public FastWriter println(char[]... map) { return writeln(map); }
		public FastWriter println(String s) { return writeln(s); }
		public FastWriter println() { return writeln(); }
	}

	public void trnz(int... o)
	{
		for(int i = 0;i < o.length;i++)if(o[i] != 0)System.out.print(i+":"+o[i]+" ");
		System.out.println();
	}

	// print ids which are 1
	public void trt(long... o)
	{
		Queue<Integer> stands = new ArrayDeque<>();
		for(int i = 0;i < o.length;i++){
			for(long x = o[i];x != 0;x &= x-1)stands.add(i<<6|Long.numberOfTrailingZeros(x));
		}
		System.out.println(stands);
	}

	public void tf(boolean... r)
	{
		for(boolean x : r)System.out.print(x?'#':'.');
		System.out.println();
	}

	public void tf(boolean[]... b)
	{
		for(boolean[] r : b) {
			for(boolean x : r)System.out.print(x?'#':'.');
			System.out.println();
		}
		System.out.println();
	}

	public void tf(long[]... b)
	{
		if(INPUT.length() != 0) {
			for (long[] r : b) {
				for (long x : r) {
					for (int i = 0; i < 64; i++) {
						System.out.print(x << ~i < 0 ? '#' : '.');
					}
				}
				System.out.println();
			}
			System.out.println();
		}
	}

	public void tf(long... b)
	{
		if(INPUT.length() != 0) {
			for (long x : b) {
				for (int i = 0; i < 64; i++) {
					System.out.print(x << ~i < 0 ? '#' : '.');
				}
			}
			System.out.println();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}


import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.function.Supplier;
import java.util.stream.Collectors;

public class cf {

	//-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;
    public static int cnt;
    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine(){
            String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
        }
	        }

    static boolean isPrime(int n)
{
    // Corner cases
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;

    return true;
}
    public static int reverseBits(int n)
    {
        int rev = 0;

        // traversing bits of 'n'
        // from the right
        while (n > 0)
        {
            // bitwise left shift
            // 'rev' by 1
            rev <<= 1;

            // if current bit is '1'
            if ((int)(n & 1) == 1)
                rev ^= 1;

            // bitwise right shift
            //'n' by 1
            n >>= 1;
        }
        // required number
        return rev;
    }

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
		StringBuilder sb = new StringBuilder();
		int t=sc.nextInt();
//		while(t-->0)
//		{
//			int n=sc.nextInt();
//			ArrayList<Integer> x1=new ArrayList<Integer>();
//			ArrayList<Integer> x2=new ArrayList<Integer>();
//
//			ArrayList<Integer> x3=new ArrayList<Integer>();
//			for(int i=0;i<n;i++)
//			{
//				x1.add(sc.nextInt());
//			}
//			for(int i=0;i<n;i++)
//			{
//				x2.add(sc.nextInt());
//			}
//			for(int i=0;i<n;i++)
//			{
//				x3.add(x2.get(i)-x1.get(i));
//			}
//			Collections.sort(x3);
//			int l=0,r=n-1,ans=0;
//			while(l<r)
//			{
//				if(x3.get(l)+x3.get(r)>=0)
//				{
//					l++;
//					r--;
//					ans++;
//				}
//				else
//				{
//					l++;
//				}
//			}
//			out.println(ans);
//		}
		ArrayList<Long> x=new ArrayList<Long>();
		x.add((long) 3);
		x.add((long) 5);
		long k=5;
		k=k+2;
		while(x.size()<=t)
		{
			x.add(k);
			x.add(k+1);
			x.add(k+2);
			k=k+4;
		}
		Collections.sort(x);
		out.println(x.get(t-1));
		out.close();
	}
}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//package solution1;

import java.io.*;
import java.util.*;

/**
 *
 * @author Beaudelaire HOUNDO
 */
public class Solution1 {
         public static long solve(long n){
             long ans=0;
             if(n==1){
                 ans=3;
             }
             if(n==2){
                 ans=5;
             }
             if(n==3){
                 ans=7;
             }
             if(n>3){
                 long current=7;
                 for(int i=4;i<=n;i++){
                     if(i%3==0){
                         current+=2;
                     }else{
                         current+=1;
                     }

                 }
                 ans=current;
             }

           return ans;
         }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
         ArrayList<Integer> A= new ArrayList<Integer>();
           ArrayList<Integer> B= new ArrayList<Integer>();
         //Scanner in= new  Scanner(System.in);
        //int t=in.nextInt();
        //for(int i=0;i<t;i++){
            long n=in.nextLong();
            /*for(int i=1;Math.pow(i, 2)<=Math.pow((n+1), 2);i++){
                B.add((int)Math.pow(i, 2));
            }
            //System.out.println(B.size());
            for(int i=0;i<B.size()-1;i++){
                for(int j=i+1;j<B.size();j++){
                    A.add(B.get(j)-B.get(i));
                   // System.out.println("okay");
                }
            }*/

            System.out.println(solve(n));
        //}

}
}


import java.io.Writer;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.*;
import java.io.*;
import java.math.*;
import java.util.concurrent.TimeUnit;
public class check {
    public static int find(ArrayList<Integer> inp, int n, int target){
        Collections.sort(inp);
        Collections.reverse(inp);
        int res = 0;
        int num = n;
        for(int i = 0;i<n && num>0;i++){
            int curr = inp.get(i);
            int times = target/curr;
            if(target%curr != 0)
                times++;
            if(times*curr<=target)
                times++;
            if(times>num)
                return res;
            num = num-times;
            res++;
        }
        return res;
    }

    public static void main(String args[]) throws java.lang.Exception{
        Scanner in;
        try{
            in = new Scanner(new FileReader("./input.txt"));
        }
        catch(Exception e){
            in = new Scanner(System.in);
        }
        int n = in.nextInt();

        long st = 3;
        if(n == 1){
            System.out.println(3);
            return;
        }
        int t = 0;
        int flag = 0;
        for(int i = 2;i<=n;i++){
            if(flag == 1){
                st++;
                flag = 0;
                t++;
            }
            else if(t<2){
                st = st+2;
                t++;
            }
            else{
                st++;
                t = 0;
                flag = 1;
            }
            //System.out.println(i+" "+st);
        }
        System.out.println(st);
    }
}


import java.util.Scanner;

public class Class1 {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int  a = scan.nextInt();
		System.out.println(2*a+1);
	}
}


/*
  Goal: Become better in CP!
  Key: Consistency and Discipline
  Desire: SDE @ Google USA
  Motto: Do what i Love <=> Love what i do
  If you don't use your brain 100%, it deteriorates gradually
*/

import java.util.*;
import java.io.*;
import java.math.*;

public class Code {

  static StringBuffer str=new StringBuffer();
  static BufferedReader bf;
  static PrintWriter pw;
  static long n;
  static long d;
  static long p[];

  static long solve(int te) throws Exception{
    if(n==1) return 3;
    if(n==2) return 5;
    if(n==3) return 7;
    if(n==4) return 8;
    if(n==5) return 9;
    if(n==6) return 11;
    if(n==7) return 12;
    if(n==8) return 13;

    long tn=n-(n+3)/4-3;
    long pn=n;
    while(tn<n){
      pn+=n/4;
      tn=pn-(pn+3)/4-3;
    }
    if(tn==n){
      while(pn%2==0 || pn%4!=0) pn--;
      return pn;
    }else{
      while(tn==n){
        pn--;
        tn=pn-(pn+3)/4-3;
      }
      while(pn%2==0 || pn%4!=0) pn--;
      return pn;
    }
  }

  public static void main(String[] args) throws java.lang.Exception {
    boolean lenv=false;
    if(lenv){
      bf = new BufferedReader(
                          new FileReader("input.txt"));
      pw=new PrintWriter(new
            BufferedWriter(new FileWriter("output.txt")));
    }else{
      bf = new BufferedReader(new InputStreamReader(System.in));
      pw = new PrintWriter(new OutputStreamWriter(System.out));
    }

    // int q1 = Integer.parseInt(bf.readLine().trim());
    // for(int te=1;te<=q1;te++) {
      // String s[]=bf.readLine().trim().split("\\s+");
      n=Long.parseLong(bf.readLine().trim());
      // d=Long.parseLong(s[1]);
      // p=new long[n];
      // s=bf.readLine().trim().split("\\s+");
      // for(int i=0;i<n;i++) p[i]=Long.parseLong(s[i]);
      str.append(solve(1));
    // }
    pw.print(str);
    pw.flush();
    // System.out.println(str);
  }
}


// "static void main" must be defined in a public class.
import java.util.*;
import java.io.*;
public class Solution {

    public static void main(String[] args) {
		FastScanner fs=new FastScanner();
		PrintWriter out=new PrintWriter(System.out);

        long N = fs.nextLong();

        long ans = 0;
        if(N == 1) {
            ans = 1;
        }else if(N%3 == 0) {
            ans = (N/3) * 4 + 3;
        }else if(N%3 == 1 && N != 1) {
            ans = (N/3) * 4 + 4;
        }else if(N%3 == 2) {
            ans = (N/3) * 4 + 5;
        }

        out.println(ans);
		out.close();
	}

    static int gcd(int a, int b) {
        if(b == 0) {
            return a;
        }else{
            return gcd(b, a%b);
        }
    }

    static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
                                        st=new StringTokenizer(br.readLine());
                                } catch (IOException e) {}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		long nextLong(){
			return Long.parseLong(next());
		}
	}

}


/*
  Goal: Become better in CP!
  Key: Consistency and Discipline
  Desire: SDE @ Google USA
  Motto: Do what i Love <=> Love what i do
  If you don't use your brain 100%, it deteriorates gradually
*/

import java.util.*;
import java.io.*;
import java.math.*;

public class Code {

  static StringBuffer str=new StringBuffer();
  static BufferedReader bf;
  static PrintWriter pw;
  static long n;

  static void solve(int te) throws Exception{
    if(n==1) return 3;
    return 4 + (4*n-3)/3;
  }

  public static void main(String[] args) throws java.lang.Exception {
    boolean lenv=false;
    if(lenv){
      bf = new BufferedReader(
                          new FileReader("input.txt"));
      pw=new PrintWriter(new
            BufferedWriter(new FileWriter("output.txt")));
    }else{
      bf = new BufferedReader(new InputStreamReader(System.in));
      pw = new PrintWriter(new OutputStreamWriter(System.out));
    }

    // int q1 = Integer.parseInt(bf.readLine().trim());
    // for(int te=1;te<=q1;te++) {
      // String s[]=bf.readLine().trim().split("\\s+");
      n=Long.parseLong(bf.readLine().trim());
      solve(1);
    // }
    pw.print(str);
    pw.flush();
    // System.out.println(str);
  }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class bubblestrike {
    public static void main(String[] args) throws IOException {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(f.readLine());
        int x = Integer.parseInt(st.nextToken());
        double prob = Double.parseDouble(st.nextToken());
        int pos = x;
        for(int a = x; a>=1; a/=2){
            while (check(pos-a,x-(pos-a),prob)){
                pos-=a;
            }
        }
        System.out.println(pos);

    }
    public static boolean check (int good, int bad, double proba){
        double g=good+0.0;
        double b=bad+0.0;
        double ans = (0.25*b*(b-1.0)+(g*(g-1)*(g-2)/6.0)+b*0.5*(g)*(g-1))/((g+b)*(g+b-1)*(g+b-2)/6.0);

        return ans >=proba;
    }
}


import java.util.*;
import java.io.*;

public class _1599_C {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        StringTokenizer line = new StringTokenizer(in.readLine());
        int n = Integer.parseInt(line.nextToken());
        double p = Double.parseDouble(line.nextToken());
        int total = choose_three(n);
        for(int i = 1; i <= n; i++) {
            double prob = 0;
            double p1 = (double)i * choose_two(n - i) / total;
            double p2 = (double)choose_two(i) * (n - i) / total;
            double p3 = (double)choose_three(i) / total;
            prob = p1 / 2 + p2 + p3;
            if(prob >= p) {
                out.println(i);
                break;
            }
        }
        in.close();
        out.close();
    }
    static int choose_two(int n) {
        if(n < 2) return 0;
        return n * (n - 1) / 2;
    }
    static int choose_three(int n) {
        if(n < 3) return 0;
        return n * (n - 1) * (n - 2) / 6;
    }
}


import java.io.*;
import java.text.*;
import java.util.*;
import java.math.*;
public class C {
    public static void main(String[] args) throws Exception {
        new C().run();
    }
    public void run() throws Exception {
        FastScanner f = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        int n = f.nextInt();
        double d = f.nextDouble();
        for(int i = 1; i <= n; i++) {
            double prob = 1.5 * i * (n-i) * (n-i-1) / n / (n-1) / (n-2);
            prob += 3.0 * i * (i-1) * (n-i) / n / (n-1) / (n-2);
            prob += 1.0 * i * (i-1) * (i-2) / n / (n-1) / (n-2);
            if(prob + 1e-8 >= d) {
                out.println(i);
                break;
            }
        }
///
        out.flush();
	}
///
	static class FastScanner {
		public BufferedReader reader;
		public StringTokenizer tokenizer;
		public FastScanner() {
			reader = new BufferedReader(new InputStreamReader(System.in), 32768);
			tokenizer = null;
		}
		public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch(IOException e) {
				throw new RuntimeException(e);
			}
		}
	}
}


import java.util.*;
public class Main
{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		char a[]=new char[26];
		int iii=0;
		for(char al='A';al<='Z';al++){
		    a[iii]=al;
		    iii++;
		}
		int len=s.length();
		boolean f=true;
		int pos1=0,pos2=0,pos3=0;
		for(int i=0;i<len-2;i++){
		    int j=0,jj=0;
		    if(s.charAt(i)==a[j]){
		        pos1=j;
		    }
		    if(s.charAt(i+1)==a[jj]){
		        pos2=jj;
		    }
		    pos3=pos1+pos2;
		    if(a[pos3]!=s.charAt(i+2)){
		        f=false;
		    }
		}
		if(f){
		    System.out.println("YES");
		}
		else{
		    System.out.println("NO");
		}
	}

}


import java.util.*;
public class Mai
{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		char a[]=new char[26];
		int iii=0;
		for(char al='A';al<='Z';al++){
		    a[iii]=al;
		    iii++;
		}
		int len=s.length();
		boolean f=true;
		int pos1=0,pos2=0,pos3=0;
		for(int i=0;i<len-2;i++){
		    int j=0,jj=0;
		    while(s.charAt(i)!=a[j]){
		        j++;
		    }
		    pos1=j;
		   while(s.charAt(i+1)!=a[jj]){
		        jj++;
		    }
		    pos2=jj;
		    pos3=pos1+pos2;
		    if(a[pos3]!=s.charAt(i+2)){
		        f=false;
		    }
		}
		if(f){
		    System.out.println("YES");
		}
		else{
		    System.out.println("NO");
		}
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class TaskA {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastReader sc = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		int test = 1;
		while(test-->0) {
			String a = sc.next();

			if(a.length()==1 || a.length()==2) {
				out.println("NO");
				continue;
			} else {
				for(int i = 2;i<a.length();i++) {
					if((a.charAt(i)-64)-Math.abs(a.charAt(i-1)-64+a.charAt(i-2)-64)%26>1 || (Math.abs((a.charAt(i)-64)-Math.abs(a.charAt(i-1)-64+a.charAt(i-2)-64)%26)==0)) {
						out.println("NO");
						out.close();
						System.exit(0);
					}
				}
				out.println("YES");
			}
		}

		out.close();
	}
	static class FastReader {

		StringTokenizer st;
		BufferedReader br;

		public FastReader() {
			br = new BufferedReader(
					new InputStreamReader(System.in));
		}

		String next() {
			while(st==null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String s = "";
			while(st==null || st.hasMoreElements()) {
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return s;
		}
	}
}


import java.util.*;
import java.io.*;

public class Main {

    public static class Pair implements Comparable < Pair > {
        int d;
        int i;
        Pair(int d, int i) {
            this.d = d;
            this.i = i;
        }
        public int compareTo(Pair o) {
            return this.d - o.d;
        }

    }

    public static class SegmentTree {
        long[] st;
        long[] lazy;
        int n;

        SegmentTree(long[] arr, int n) {
            this.n = n;
            st = new long[4 * n];
            lazy = new long[4 * n];

            construct(arr, 0, n - 1, 0);

        }

        public long construct(long[] arr, int si, int ei, int node) {
            if (si == ei) {
                st[node] = arr[si];
                return arr[si];
            }

            int mid = (si + ei) / 2;

            long left = construct(arr, si, mid, 2 * node + 1);
            long right = construct(arr, mid + 1, ei, 2 * node + 2);

            st[node] = left + right;

            return st[node];
        }

        public long get(int l, int r) {
            return get(0, n - 1, l, r, 0);
        }

        public long get(int si, int ei, int l, int r, int node) {
            if (r < si || l > ei)
                return 0;

            if (lazy[node] != 0) {
                st[node] += lazy[node] * (ei - si + 1);

                if (si != ei) {
                    lazy[2 * node + 1] += lazy[node];
                    lazy[2 * node + 2] += lazy[node];
                }
                lazy[node] = 0;
            }

            if (l <= si && r >= ei)
                return st[node];

            int mid = (si + ei) / 2;

            return get(si, mid, l, r, 2 * node + 1) + get(mid + 1, ei, l, r, 2 * node + 2);
        }

        public void update(int index, int value) {
            update(0, n - 1, index, 0, value);
        }

        public void update(int si, int ei, int index, int node, int val) {
            if (si == ei) {
                st[node] = val;
                return;
            }
            int mid = (si + ei) / 2;

            if (index <= mid) {
                update(si, mid, index, 2 * node + 1, val);
            } else {
                update(mid + 1, ei, index, 2 * node + 2, val);
            }

            st[node] = st[2 * node + 1] + st[2 * node + 2];
        }

        public void rangeUpdate(int l, int r, int val) {
            rangeUpdate(0, n - 1, l, r, 0, val);
        }

        public void rangeUpdate(int si, int ei, int l, int r, int node, int val) {
            if (r < si || l > ei)
                return;

            if (lazy[node] != 0) {
                st[node] += lazy[node] * (ei - si + 1);

                if (si != ei) {
                    lazy[2 * node + 1] += lazy[node];
                    lazy[2 * node + 2] += lazy[node];
                }
                lazy[node] = 0;
            }

            if (l <= si && r >= ei) {
                st[node] += val * (ei - si + 1);
                if (si != ei) {
                    lazy[2 * node + 1] += val;
                    lazy[2 * node + 2] += val;
                }

                return;
            }

            int mid = (si + ei) / 2;

            rangeUpdate(si, mid, l, r, 2 * node + 1, val);
            rangeUpdate(mid + 1, ei, l, r, 2 * node + 2, val);

            st[node] = st[2 * node + 1] + st[2 * node + 2];
        }
    }

    static class Reader {

        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(
                new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n') {
                    if (cnt != 0) {
                        break;
                    } else {
                        continue;
                    }
                }
                buf[cnt++] = (byte)c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ') {
                c = read();
            }
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (c == '.') {
                while ((c = read()) >= '0' && c <= '9') {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0,
                                 BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        }
    }
    public static void main(String[] args) throws IOException {

        if (System.getProperty("ONLINE_JUDGE") == null) {
            try {
                System.setIn(new FileInputStream(new File("input.txt")));
                System.setOut(new PrintStream(new File("output.txt")));
            } catch (Exception e) {
            }
        }

        Reader sc = new Reader();

        int tc = 1;

        StringBuilder sb = new StringBuilder();

        while (tc-- > 0) {
            sb.append("YES");

        }

        System.out.println(sb);

    }

    public static int get(int[] dsu, int x) {

        if (dsu[x] == x)
            return x;

        int k = get(dsu, dsu[x]);

        dsu[x] = k;

        return k;

    }

    static int gcd(int a, int b) {
        // Everything divides 0
        if (a == 0)
            return b;
        if (b == 0)
            return a;

        // base case
        if (a == b)
            return a;

        // a is greater
        if (a > b)
            return gcd(a - b, b);
        return gcd(a, b - a);
    }

    public static int Xor(int n) {
        if (n % 4 == 0)
            return n;

        // If n%4 gives remainder 1
        if (n % 4 == 1)
            return 1;

        // If n%4 gives remainder 2
        if (n % 4 == 2)
            return n + 1;

        // If n%4 gives remainder 3
        return 0;
    }

    public static long pow(long a, long b, long mod) {
        long res = 1;
        while (b > 0) {
            if ((b & 1) > 0)
                res = (res * a) % mod;
            b = b >> 1;
            a = ((a % mod) * (a % mod)) % mod;
        }

        return (res % mod + mod) % mod;
    }

    public static double digit(long num) {
        return Math.floor(Math.log10(num) + 1);
    }

    public static boolean isPos(int idx, long[] arr, long[] diff) {
        if (idx == 0) {
            for (int i = 0; i <= Math.min(arr[0], arr[1]); i++) {
                diff[idx] = i;
                arr[0] -= i;
                arr[1] -= i;
                if (isPos(idx + 1, arr, diff)) {
                    return true;
                }
                arr[0] += i;
                arr[1] += i;
            }
        } else if (idx == 1) {
            if (arr[2] - arr[1] >= 0) {
                long k = arr[1];
                diff[idx] = k;
                arr[1] = 0;
                arr[2] -= k;
                if (isPos(idx + 1, arr, diff)) {
                    return true;
                }
                arr[1] = k;
                arr[2] += k;

            } else
                return false;

        } else {
            if (arr[2] == arr[0] && arr[1] == 0) {
                diff[2] = arr[2];
                return true;
            } else {
                return false;
            }
        }

        return false;
    }

    public static boolean isPal(String s) {

        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) != s.charAt(s.length() - 1 - i))
                return false;
        }

        return true;
    }

    static int upperBound(ArrayList<Long> arr, long key) {
        int mid, N = arr.size();

        // Initialise starting index and
        // ending index
        int low = 0;
        int high = N;

        // Till low is less than high
        while (low < high && low != N) {
            // Find the index of the middle element
            mid = low + (high - low) / 2;

            // If key is greater than or equal
            // to arr[mid], then find in
            // right subarray
            if (key >= arr.get(mid)) {
                low = mid + 1;
            }

            // If key is less than arr[mid]
            // then find in left subarray
            else {
                high = mid;
            }
        }

        // If key is greater than last element which is
        // array[n-1] then upper bound
        // does not exists in the array
        return low;
    }

    static int lowerBound(ArrayList<Long> array, long key) {
        // Initialize starting index and
        // ending index
        int low = 0, high = array.size();
        int mid;

        // Till high does not crosses low
        while (low < high) {

            // Find the index of the middle element
            mid = low + (high - low) / 2;

            // If key is less than or equal
            // to array[mid], then find in
            // left subarray
            if (key <= array.get(mid)) {
                high = mid;
            }

            // If key is greater than array[mid],
            // then find in right subarray
            else {

                low = mid + 1;
            }
        }

        // If key is greater than last element which is
        // array[n-1] then lower bound
        // does not exists in the array
        if (low < array.size() && array.get(low) < key) {
            low++;
        }

        // Returning the lower_bound index
        return low;
    }

}


import java.util.*;
public class Main {
    public static void main(String[] args) {
        int prob = Math.random() > 0.5 ? 1 : 0;
        if (prob == 1) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}


import java.io.BufferedReader;
import java.io.InputStreamReader;

public class B {
    public static void main(String[] args) throws Exception {
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        int t = 1;
        while (t-- > 0) {
            int num = Integer.parseInt(buffer.readLine());
            sb.append((int) Math.sqrt(num)).append("\n");
        }
        System.out.println(sb);
    }
}


import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.Vector;

public class codeforce {
	static Scanner sc = new Scanner(System.in);
	static Vector<String> ve = new Vector<>();
	static List<Integer> list = new ArrayList<Integer>();
	public static void main(String[] args) {
		b1505C();
	}
	public static void b1505C() {
		String a = sc.next();
		char[] s = a.toCharArray();
		if((s[0] - 'A' + s[1] - 'A') == s[2] - 'A' || a.length() < 2) System.out.println("YES");
		else System.out.println("NO");
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;

public class C

{
    class Pair<S extends Comparable<S>, T extends Comparable<T>> implements Comparable<Pair<S, T>> {
        S first;
        T second;

        Pair(S f, T s) {
            first = f;
            second = s;
        }

        @Override
        public int compareTo(Pair<S, T> o) {
            int t = first.compareTo(o.first);
            if (t == 0) return second.compareTo(o.second);
            return t;
        }

        @Override
        public int hashCode() {
            return (31 + first.hashCode()) * 31 + second.hashCode();
        }

        @Override
        public boolean equals(Object o) {
            if (!(o instanceof Pair)) return false;
            if (o == this) return true;
            Pair p = (Pair) o;
            return first.equals(p.first) && second.equals(p.second);
        }

        @Override
        public String toString() {
            return "Pair{" + first + ", " + second + "}";
        }
    }
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    public static void main (String[] args) throws java.lang.Exception
    {
        try {
            System.setIn(new FileInputStream("input.txt"));
            System.setOut(new PrintStream(new FileOutputStream("output.txt")));
        } catch (Exception e) {
            System.err.println("Error");
        }

        FastReader sc = new FastReader();
        int t =sc.nextInt();
        PrintWriter out=new PrintWriter(System.out);
        while(t-->0){
            solve(sc,out);
        }
         out.close();
    }
    static void solve(FastReader sc,PrintWriter out) {
        char s[] =  sc.next().toCharArray();
        if(s.length<3){
            out.println("YES");
        }
        else{
            for(int i=2;i<s.length;i++){
                if((s[i-1]+s[i-2]-130)%26!=s[i]-65){
                    out.println("NO");
                    return;
                }
            }
        }
        out.println("YES");

    }
}


package AprilFoolsCodeforces;
import java.io.*;
public class fibonaciiWord
{
	public static void main(String[] args)throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s=br.readLine();
		if(s.length()<=2)System.out.println("YES");
		boolean check=false;
		for(int i=2;i<s.length();i++)
		{

			int sum=s.charAt(i-1)-65+s.charAt(i-2)-65;
			if(sum%26==(s.charAt(i)-65)%26)check=true;
			else {check=false;break;}

		}
		if(check) System.out.println("YES");
		else System.out.println("NO");
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
import java.text.*;

public class Codeforces {

	static int mod=1000_000_007 ;
	//static int n,m;
	public static void main(String[] args) throws Exception {
		PrintWriter out=new PrintWriter(System.out);
	    FastScanner fs=new FastScanner();
	    String str=fs.next();
	    String arr[]= {"YES", "NO"};
	    Random r=new Random();
	    int ind=r.nextInt(2);
	    System.out.println(arr[ind]);
//	    int t=fs.nextInt();
//	    outer : while(t-->0) {
//	    	int  n=fs.nextInt();
//	    	 int arr[]=fs.readArray(n);
//	    	 //Map<Integer,Integer> map=new HashMap<>();
//	    	 int min=Integer.MAX_VALUE;
//	    	 for(int i=0;i<n;i++) {
//	    		 min=Math.min(min, arr[i]);
//	    	 }
//	    	 long cnt=0;
//	    	 for(int x:arr) {
//	    		 if(x==min) cnt++;
//	    		 if((min&x)!=min){
//	    			// out.println("here");
//	    			 out.println(0);
//	    			 continue outer;
//	    		 }
//
//	    	 }
//	    	 long ans=0;
//	    	 if(cnt>1) {
//	    		// System.out.println("here");
//	    		 ans=1;
//	    		 ans= (((cnt*(cnt-1))%mod)*fact(n-2))%mod;
//	    	 }
//
//	    	 out.println(ans);
//	    }
	    out.close();
    }

	static long fact(long n) {
		long res=1;
		for(int i=2;i<=n;i++) {
			res*=i;
			res%=mod;
		}
		return res;
	}
	static int gcd(int  a,int  b) {
		if(b==0) return a;
		return gcd(b,a%b);
	}
    static void sort(int[] a) {
		//suffle
		int n=a.length;
		Random r=new Random();
		for (int i=0; i<a.length; i++) {
			int oi=r.nextInt(n);
			int temp=a[i];
			a[i]=a[oi];
			a[oi]=temp;
		}

		//then sort
		Arrays.sort(a);
	}
	// Use this to input code since it is faster than a Scanner
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

}


import java.io.*;
import java.util.*;

public class Solution {

    public static void main(String[] args) {
        Solution solver = new Solution();
        InputReader in = new InputReader(System.in);
        StringBuilder answer = new StringBuilder();

        int T = in.readInt();
        for (int t = 1; t <= T; t++) {
            String s = in.readString();
            answer.append(solver.solve(s)).append('\n');
        }

        System.out.print(answer);
    }

    public String solve(String s) {

        for (int i = 2;i < s.length();i++) {
            if (((s.charAt(i-1)%65) + (s.charAt(i-2)%65))%26 != s.charAt(i)%65) {
                return "NO";
            }
        }

        return "YES";
    }
}

class InputReader
{
    private InputStream stream;
    private byte[] buffer = new byte[1024];
    private int currentChar;
    private int numberOfChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numberOfChars == -1)
            throw new InputMismatchException();
        if (currentChar >= numberOfChars) {
            currentChar = 0;
            try {
                numberOfChars = stream.read(buffer);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numberOfChars <= 0)
                return -1;
        }
        return buffer[currentChar++];
    }

    public boolean isSpace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public int readInt() {
        int c = read();
        while (isSpace(c))
            c = read();

        byte sign = 1;
        if (c == '-') {
            sign = -1;
            c = read();
        }

        int result = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            result *= 10;
            result += (c - '0');
            c = read();
        }
        while (!isSpace(c));
        return sign * result;
    }

    public long readLong() {
        int c = read();
        while (isSpace(c))
            c = read();

        byte sign = 1;
        if (c == '-') {
            sign = -1;
            c = read();
        }

        long result = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            result *= 10;
            result += (c - '0');
            c = read();
        }
        while (!isSpace(c));

        return sign * result;
    }

    public double readDouble() {
        int c = read();
        while (isSpace(c))
            c = read();

        byte sign = 1;

        if (c == '-') {
            sign = -1;
            c = read();
        }

        double result = 0.0;

        while (!isSpace(c) && c != '.') {
            if (c == 'e' || c == 'E')
                return result * Math.pow(10, readInt());
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            result *= 10;
            result += (c - '0');
            c = read();
        }
        if (c == '.') {
            c = read();
            double m = 1;
            while (!isSpace(c)) {
                if (c == 'e' || c == 'E')
                    return result * Math.pow(10, readInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                m /= 10;
                result += (c - '0') * m;
                c = read();
            }
        }
        return result * sign;
    }

    public String readString() {
        int c = read();
        while (isSpace(c))
            c = read();
        StringBuilder result = new StringBuilder();
        do {
            result.appendCodePoint(c);
            c = read();
        }
        while (!isSpace(c));

        return result.toString();
    }
}


package Codeforces;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class AprilFoolConetst {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastScanner fs = new FastScanner();
		char[] line = fs.next().toCharArray();
		if (line.length <= 2) {
			System.out.println("YES");
			return;
		}
		int[] fib_no = new int[line.length];
		fib_no[0] = line[0] - 'A';
		fib_no[1] = line[1] - 'A';
		for(int i = 2; i < line.length; i++) {
			if((line[i]-'A') != (((line[i-1]-'A')+(line[i-2]-'A'))%26)) {
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");

	}
	static class FastScanner{
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer s = new StringTokenizer("");
		public String next() {
			while(!s.hasMoreElements()) {
				try {
					s = new StringTokenizer(bf.readLine());

				}catch(IOException e) {
					e.printStackTrace();

				}

			}
			return s.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public int[] readArray(int n) {
			int[] a = new int[n];
			for(int i = 0; i < a.length; i++) a[i] = nextInt();
			return a;
		}
		public long nextLong() {
			return Long.parseLong(next());
		}

	}

}


import java.util.HashMap;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		fib(s);
	}

	public static void fib(String s) {
		if (s.length() == 1 || s.length() == 2) {
			System.out.println("TRUE");
		}
		else {
			for (int i = 2; i < s.length(); i++) {
				if ((s.charAt(i-2)-'A' + s.charAt(i-1)-'A')%26 != s.charAt(i)-'A') {
					System.out.println("FALSE");
					return;
				}
			}
			System.out.println("TRUE");
		}

	}
}


import java.io.*;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class B_DMCA {
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static StringTokenizer st;

    private static int readInt() throws IOException {
        while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
        return Integer.parseInt(st.nextToken());
    }

    public static void main(String[] args) throws IOException {
        System.out.println(digitSum(readInt()));
    }

    private static int digitSum(int n) {
        int s = 0;
        while (n > 0) {
            s += n % 10;
            n /= 10;
        }
        return s;
    }
}


import java.util.*;

import java.io.*;

public class Main implements Runnable {

  public static void main(String[] args) {
    new Thread(null, new Main(), "whatever", 1 << 26).start();
  }

  private Scanner sc;
  private StringBuilder sb;

  public void run() {
    sc = new Scanner(System.in);
    // sb=new StringBuilder();
    // int t = sc.nextInt();
    // while (t-- > 0) {
      solve();
    // }
  }

  public void solve() {
      String s=sc.next().toLowerCase();
      if(s.length()<=2){
          System.out.println("YES");
          return;
      }
      int ppch,pch,ch;
      ppch=s.charAt(0)-'a';
      pch=s.charAt(1)-'a';
      for(int i=2;i<s.length();i++){
          ch=s.charAt(i)-'a';
          if(ch==(pch+ppch)){
              ppch=pch;
              pch=ch;
          }else{
              System.out.println("NO");
              return;
          }
      }
      System.out.println("YES");
  }

  class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner() {
      reader = new BufferedReader(new InputStreamReader(System.in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken("\n");
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public float nextFloat() {
      return Float.parseFloat(next());
    }

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++) {
        a[i] = nextInt();
      }
      return a;
    }

    public String[] nextStringArray(int n) {
      String[] a = new String[n];
      for (int i = 0; i < n; i++) {
        a[i] = next();
      }
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++) {
        a[i] = nextLong();
      }
      return a;
    }

  }

}