using System;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main()
        {
            //var s = Console.ReadLine().Split(' ');
            var str = Console.ReadLine();
            var k = long.Parse(str.Substring(0,str.Length-1));
            byte g = 0;
            switch (str[str.Length - 1])
            {
                case 'a':
                    g = 4;
                    break;
                case 'b':
                    g = 5;
                    break;
                case 'c':
                    g = 6;
                    break;
                case 'd':
                    g = 3;
                    break;
                case 'e':
                    g = 2;
                    break;
                case 'f':
                    g = 1;
                    break;
            }
            var result = 0;
            while (k > 4)
            {
                result += 16;
                k -= 4;
            }
            if (k%2 == 0)
            {
                result += 7 + g;
            }
            else result += g;
            Console.WriteLine(result);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _725B {
    class Program {
        static void Main(string[] args) {
            int row = Console.Read() - '0';
            int col = Console.Read() - 'c'; //a = -2, b = -1, c = 0, d = 1, e = 2, f = 3
            int seconds = 0;

            if(col <= 0) {
                seconds += 6 + col;
            } else {
                seconds += 4 - col;
            }

            //1, 2, 5, 6, 9, 10 - attendant A
            //3, 4, 7, 8, 11, 12 - attendant B
            int a = 1;
            int b = 3;
            for(; (a != row) && (b != row); a++, b++) { //quit when attendant reaches row
                if(a % 2 == 0) {
                    a += 2;
                    b += 2;
                    seconds += 2;
                }
                seconds += 7;
            }
            Console.WriteLine(seconds);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int a;
            int temp = 0;
            a = Convert.ToInt32(Console.ReadLine());
            if (a%2 != 0)
            {
                Console.WriteLine("NO");
            }
            else if (a%2 == 0)
            {
                for (int i = 0; i <= a; i++)
                {
                    if (i%2 == 0)
                    {
                        if ((a/i)%2 == 0)
                        {
                            Console.WriteLine("YES");
                            temp++;
                            break;
                        }
                    }
                }
                if (temp == 0)
                {
                    Console.WriteLine("NO");
                }
            }
            Console.ReadLine();

        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string weight0;
            int weight;

           weight0 = Console.ReadLine();
            weight = Convert.ToInt32(weight0);

            if (weight % 2 == 0 && weight != 2)
            {
                Console.WriteLine("YES");

            }

            else
            {
                Console.WriteLine("NO");

            }

        }


<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{FC6F239C-0743-41DF-8B79-D5E8087150B1}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <RootNamespace>_4A</RootNamespace>
    <AssemblyName>4A</AssemblyName>
    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace p11
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int w, p1, p2;

                w = Convert.ToInt32(Console.ReadLine());

                if (1 <= w && w <= 100)
                {
                    if (w % 2 == 0)
                    {
                        Console.WriteLine("YES");
                    }
                    else
                    {
                        p1 = w - (w / 2);
                        p2 = w - p1;

                        if (p1 % 2 == 0 && p2 % 2 == 0)
                        {
                            Console.WriteLine("YES");
                        }

                    }

                }

            }

        }
    }
}


namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            double x = Convert.ToDouble(Console.ReadLine());
            double y = x / 2;
            if (y % 1 != 0)
            {
                Console.WriteLine("NO");
            }
                else{
                Console.WriteLine("YES");
            }
        }
    }
}


    public class Program
    {
        public static void Main()
        {
          int a = Console.ReadLine();
          if (a % 2 == 0) Console.WriteLine("YES");
          else Console.WriteLine("NO");
        }
    }


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Program1
{
    class Program1
    {
        static void Main(string[] args)
        {
            int x, j;

            bool res = false;

            x = Int32.Parse(Console.ReadLine());

            for(int i = 2; i < 8; i+2)
            {
                j = x - i;

                if(j % 2 == 0)
                    res = true;
            }

            if(res == true)
                Console.WriteLine("YES");
            else
               Console.WriteLine("NO");
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

// (づ°ω°)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    const long MAX = 2000000000000000000;
    int n;
    long[] f = new long[51];
    long?[] mem = new long?[51];
    List<int> ans = new List<int>();
    long Fun(int x)
    {
        if (x == n)
            return 1;
        if (mem[x].HasValue)
            return mem[x].Value;
        long ret = 0;
        for (int i = 1; x + i <= n; i++)
            if (ret + 1.0 * f[i - 1] * Fun(x + i) > MAX)
                ret = MAX;
            else
                ret += f[i - 1] * Fun(x + i);
        return (mem[x] = ret).Value;
    }

    void Fun2(int x, long y)
    {
        if (x == n)
            return;
        for (int i = 1; x + i <= n; i++)
            if (y - 1.0 * f[i - 1] * Fun(x + i) < 0)
            {
                long z = Fun(x + i);
                ans.Add(x + i);
                if (i > 1)
                {
                    var p = Nth(i - 1, y / z);
                    foreach (int v in p)
                        ans.Add(v + x);
                }
                Fun2(x + i, y % z);
                return;
            }
            else
                y -= f[i - 1] * Fun(x + i);
        throw new Exception();
    }

    int[] Nth(int n, long m)
    {
        var p = Enumerable.Range(1, n).ToList();
        var ret = new int[n];
        for (int i = 0; i < n; i++)
        {
            long f = 1;
            for (int j = 2; j <= n - i - 1; j++)
                f = f * j;
            int d = (int)(m / f);
            ret[i] = p[d];
            p.RemoveAt(d);
            m %= f;
        }

        return ret;
    }

    void Solve()
    {
        f[0] = 1;
        for (int i = 1; i <= 50; i++)
            if (1.0 * f[i - 1] * i > MAX)
                f[i] = MAX;
            else
                f[i] = f[i - 1] * i;

        n = ReadInt();
        long m = ReadLong() - 1;

        Fun2(0, m);
        WriteArray(ans);
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("hull.in");
        //writer = new StreamWriter("hull.out");
#endif
        try
        {
            //            var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
            //            thread.Start();
            //            thread.Join();
            checked
            {
                new Solver().Solve();
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
#if DEBUG
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write
    private static Queue<string> currentLineTokens = new Queue<string>();
    private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries); }
    public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue<string>(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }
    public static int ReadInt() { return int.Parse(ReadToken()); }
    public static long ReadLong() { return long.Parse(ReadToken()); }
    public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }
    public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }
    public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }
    public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }
    public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;
    }
    public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }
    public static void WriteArray<T>(IEnumerable<T> array) { writer.WriteLine(string.Join(" ", array)); }
    public static void Write(params object[] array) { WriteArray(array); }
    public static void WriteLines<T>(IEnumerable<T> array) { foreach (var a in array)writer.WriteLine(a); }
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }
    private static T[] Init<T>(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }
    #endregion
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApp1
{
    class Program
    {

        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int v = Convert.ToInt32(input[0]);
            int e = Convert.ToInt32(input[1]);

            bool[,] G = new bool[8, 8];

            for(int i = 1; i <= e; ++i)
            {
                input = Console.ReadLine().Split(' ');
                int x = Convert.ToInt32(input[0]);
                int y = Convert.ToInt32(input[1]);
                G[x, y] = true;
                G[y, x] = true;
            }

            if(v < 7)
            {
                //无重复
                Console.WriteLine(e.ToString());
            }
            else
            {
                //有
                int delmin = 1000;
                for(int i = 1; i <= 7; ++i)
                {
                    //i 和 j 为重复
                    for(int j = i + 1; j <= 7; ++j)
                    {
                        int cnt = 0;
                        for(int k = 1; k <= 7; ++k)
                        {
                            if(G[i, k] && G[j, k])
                            {
                                cnt++;
                            }
                        }
                        delmin = Math.Min(cnt, delmin);
                    }
                }
                Console.WriteLine((v - delmin).ToString());
            }

        }
    }
}


using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		int N = int.Parse(str[0]);
		int M = int.Parse(str[1]);
		int[,]A = new int[M,2];
		int[]C = new int[N];
		for(var i=0;i<M;i++){
			string[] str2 = Console.ReadLine().Split();
			A[i,0] = int.Parse(str2[0]);
			A[i,1] = int.Parse(str2[1]);
			C[A[i,0]-1]++;
			C[A[i,1]-1]++;
		}
		int ans = 0;
		if(N<7){
			ans = M;
		} else {
			bool flag = false;
			for(var i=0;i<N;i++){
				if(C[i]<=1){
					flag = true;
				}
			}
			if(flag){
				ans = M;
			} else {
				int min = 99;
				for(var i=0;i<N;i++){
					min = Math.Min(C[i],min);
				}
				ans = M-min+1;
			}
		}
		Console.WriteLine(ans);
	}
}


using System;
using System.IO;
using System.Text;

namespace Anadi_and_Domino
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static int[] p;
        private static int[] size1;
        private static int[] size2;

        private static void Main(string[] args)
        {
            writer.WriteLine(Solve(args));
            writer.Flush();
        }

        private static int Solve(string[] args)
        {
            int n = Next();
            int m = Next();

            p = new int[n];
            var t = new int[n];
            var mask = new int[n];
            size1 = new int[n];
            size2 = new int[n];
            for (int i = 0; i < n; i++)
            {
                p[i] = i;
                size1[i] = 1;
            }

            var mm = new Tuple<int, int>[m];
            for (int i = 0; i < m; i++)
            {
                int a = Next() - 1;
                int b = Next() - 1;
                mm[i] = new Tuple<int, int>(a, b);
                t[a]++;
                t[b]++;
                mask[a] |= (1 << b);
                mask[b] |= (1 << a);

                int pa = GP(a);
                int pb = GP(b);
                if (pa != pb)
                {
                    p[pa] = pb;
                    size2[pb] += 1 + size2[pa];
                    size1[pb] += size1[pa];
                }
                else
                {
                    size2[pa]++;
                }
            }

            int ans = 0;
            for (int i = 0; i < n; i++)
            {
                if (p[i] == i)
                {
                    if (size1[i] < 7)
                        ans += size2[i];
                    else
                    {
                        int min = 5;
                        foreach (var y in mm)
                        {
                            int r = t[y.Item1] + t[y.Item2] - 1 - (SparseBitcount(mask[y.Item1] | mask[y.Item2]) - 1);
                            min = Math.Min(min, Math.Max(0, r));
                        }

                        ans = size2[i] - min;
                        break;
                    }
                }
            }

            return ans;
        }

        private static int SparseBitcount(int n)
        {
            int count = 0;
            while (n != 0)
            {
                count++;
                n &= (n - 1);
            }
            return count;
        }

        private static int GP(int i)
        {
            if (i == p[i])
                return i;
            return p[i] = GP(p[i]);
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}


//#define EXTENDSTACKSIZE

using System;
 using System.Collections.Generic;
 using System.Globalization;
using System.IO;
using System.Linq;
 using System.Text;
 using System.Threading;

         namespace CF
{
    internal class Program
    {
        private const int stackSize = 64 * 1024 * 1024;

        private static void Run()
        {
            using (var sr = new InputReader(Console.In))
//            using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
//            using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }

        private static void Main(string[] args)
        {
#if EXTENDSTACKSIZE
            var threadStart = new ThreadStart(Run);
            var thread = new Thread(threadStart, stackSize);
            thread.Start();
            thread.Join();
#else
            Run();
#endif
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        private Graph graph;

        private int answ;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            var n = sr.NextInt32();
            var m = sr.NextInt32();
            graph = new Graph(n);
            for (var i = 0; i < m; i++)
            {
                graph.Insert(sr.NextInt32() - 1, sr.NextInt32() - 1);
            }
            Solution(-1, new int[n]);

            sw.WriteLine(answ);
        }

        private void Solution(int k, int[] values)
        {
            if (k + 1 == values.Length)
            {
                var curr = graph.Answer(values);
//                var curr = 0;
                answ = Math.Max(curr, answ);
            }
            else
            {
                k++;
                var candidates = GetCandidates(k, values);
                for (var i = 0; i < candidates.Count; i++)
                {
                    values[k] = candidates[i];
                    Solution(k, values);
                }
            }
        }

        private List<int> GetCandidates(int k, int[] values)
        {
            var inSol = new bool[values.Length];
            for (var i = 0; i < k; i++)
            {
                inSol[values[i]] = true;
            }

            var candidates = new List<int>();
            for (var i = 0; i < values.Length; i++)
            {
                if (!inSol[i])
                {
                    candidates.Add(i);
                }
            }

            return candidates;
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

class Graph
{
    private readonly List<int>[] edges;
    private int[] values;
    private bool[,] pool = new bool[7, 7];

    public Graph(int n)
    {
        edges = new List<int>[n];
    }

    public int Answer(int[] values)
    {
        this.values = values;
        for (var i = 0; i < 6; i++)
        {
            for (var j = i; j < 6; j++)
            {
                pool[i, j] = true;
            }
        }

        var visited = new bool[edges.Length];
        DfsVisit(0, -1, visited);
        var answ = 0;
        for (var i = 0; i < 6; i++)
        {
            for (var j = i; j < 6; j++)
            {
                if (!pool[i, j])
                {
                    answ++;
                }
            }
        }

        if (edges.Length == 7)
        {
            var lastVert = 0;
            for (var i = 0; i < edges.Length; i++)
            {
                if (values[i] == 6)
                {
                    lastVert = i;
                    break;
                }
            }

            if (edges[lastVert] != null && edges[lastVert].Count > 0)
            {
                answ++;
            }
        }

        return answ;
    }

    private void DfsVisit(int v, int parent, bool[] visited)
    {
        visited[v] = true;
        if (edges[v] != null)
        {
            for (var i = 0; i < edges[v].Count; i++)
            {
                if (parent != edges[v][i])
                {
                    var value = values[v];
                    var uValue = values[edges[v][i]];
                    if (pool[value, uValue])
                    {
                        pool[value, uValue] = false;
                    }
                    else
                    {
                        if (pool[uValue, value])
                        {
                            pool[uValue, value] = false;
                        }
                    }

                    if (!visited[edges[v][i]])
                    {
                        DfsVisit(edges[v][i], v, visited);
                    }
                }
            }
        }
    }

    public void Insert(int x, int y)
    {
        if (edges[x] == null)
        {
            edges[x] = new List<int>();
        }

        edges[x].Add(y);
        if (edges[y] == null)
        {
            edges[y] = new List<int>();
        }

        edges[y].Add(x);
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp5
{
    class Program
    {
        static Stack<bool> GetBinaryNumber(long number)
        {
            Stack<bool> result = new Stack<bool>();
            while (number != 0)
            {
                result.Push(number % 2 == 1);
                number /= 2;
            }
            return result;
        }
        static long FastDegree(long number, long pow)
        {
            long result = 1;
            Stack<bool> StackPow = GetBinaryNumber(pow);
            while (StackPow.Count != 0)
            {
                result *= result;
                result %= (int)(1e9 + 7);
                if (StackPow.Pop())
                {
                    result *= number;
                    result %= (int)(1e9 + 7);
                }
            }
            return result;
        }

        static int GetCountOne(int number)
        {
            int result = 0;
            while (number != 0)
            {
                if ((number & 1) == 1)
                    result++;
                number /= 2;
            }
            return result;
        }
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int n = int.Parse(str[0]);
            int m = int.Parse(str[1]);
            if (n < 7)
            {
                Console.WriteLine(m);
            }
            else
            {
                List<List<int>> G = new List<List<int>>();
                for (int i = 0; i < 7; i++)
                {
                    G.Add(new List<int>());
                }
                int temp = m;
                while(temp-- !=0)
                {
                    str = Console.ReadLine().Split();
                    int first = int.Parse(str[0]) - 1;
                    int second = int.Parse(str[1]) - 1;
                    G[first].Add(second);
                    G[second].Add(first);
                }
                int min = 6;
                for(int i =0; i<n; i++)
                {
                    if (G[i].Count < min)
                        min = G[i].Count;
                }
                if (min != 0)
                    min--;
                Console.WriteLine(m - min);
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int n = arr[0], m = arr[1];
            List<int>[] g = new List<int>[n];
            for (int i = 0; i < n; i++)
            {
                g[i] = new List<int>();
            }
            for (int i = 0; i < m; i++)
            {
                var uv = Console.ReadLine().Split().Select(int.Parse).ToArray();
                int u = uv[0], v = uv[1];
                u--;
                v--;
                g[u].Add(v);
                g[v].Add(u);
            }

            int max = 0;
            if(n<7)
            {
                max = m;
            }
            for(int i=0;i<n;i++)
            {
                if(g[i].Count == 0)
                {
                    max = m;
                }
            }
            for (int v = 0; v < n; v++)
            {

                foreach(int u in g[v])
                {
                    int temp = m;
                    int[] used = new int[n];
                    foreach(int i in g[v])
                    {
                        if (i != u)
                        {
                            used[i] = 1;
                        }
                    }
                    foreach(int i in g[u])
                    {
                        if(i!=v && used[i]==1)
                        {
                            temp--;
                        }
                    }
                    if (temp > max) max = temp;
                }
            }
            Console.WriteLine(max);
           Console.Read();
        }
    }
}
// 1 7 11 5


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static System.Math;
using System.Text;
using System.Threading;
namespace Program
{
    public static class CODEFORCES1
    {
        static public int numberOfRandomCases = 0;
        static public void MakeTestCase(List<string> _input, List<string> _output, ref Func<string[], bool> _outputChecker)
        {
        }
        static public void Solve()
        {
            var n = NN;
            var m = NN;
            var ab = Repeat(0, m).Select(_ => new { a = NN - 1, b = NN - 1 }).ToArray();
            var path = Repeat(0, n).Select(_ => new List<long>()).ToArray();
            foreach (var item in ab)
            {
                path[item.a].Add(item.b);
                path[item.b].Add(item.a);
            }
            var edgeCount = path.Select(e => e.Count).ToArray();
            var domino = new bool[6, 6];
            for (var i = 0; i < 6; i++)
            {
                for (var j = i; j < 6; j++)
                {
                    domino[i, j] = true;
                    domino[j, i] = true;
                }
            }
            var ans = 0L;
            var done = new bool[n, n];
            var vtxNumber = new long[n];
            foreach (var vtx in edgeCount.Select((e, i) => new { e, i }).OrderByDescending(e => e.e).Select(e => e.i))
            {
                foreach (var item in ab.Where(e => e.a == vtx || e.b == vtx).OrderByDescending(e =>
                {
                    if (e.a == vtx) return edgeCount[e.b];
                    else return edgeCount[e.a];
                }))
                {
                    if (done[item.a, item.b]) continue;
                    done[item.a, item.b] = true;
                    done[item.b, item.a] = true;
                    var aidx = item.a;
                    var bidx = item.b;
                    if (bidx == vtx)
                    {
                        var t = aidx; aidx = bidx; bidx = t;

                    }
                    var a = edgeCount[aidx];
                    var b = edgeCount[bidx];
                    var found = false;
                    {// find
                        for (var i = 1; i < 7; i++)
                        {
                            for (var j = 1; j < 7; j++)
                            {
                                if (domino[i - 1, j - 1])
                                {
                                    if ((vtxNumber[aidx] == 0 || vtxNumber[aidx] == i) &&
                                        (vtxNumber[bidx] == 0 || vtxNumber[bidx] == j))
                                    {
                                        vtxNumber[aidx] = i;
                                        vtxNumber[bidx] = j;
                                        domino[i - 1, j - 1] = false;
                                        domino[j - 1, i - 1] = false;
                                        found = true;
                                        break;
                                    }
                                }
                            }
                            if (found) break;
                        }
                    }
                    if (found) ++ans;
                }
            }
            Console.WriteLine(ans);
        }
        static public void Main(string[] args) { if (args.Length == 0) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); } var t = new Thread(Solve, 134217728); t.Start(); t.Join(); Console.Out.Flush(); }
        static class Console_
        {
            static Queue<string> param = new Queue<string>();
            public static string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }
        }
        static long NN => long.Parse(Console_.NextString());
        static double ND => double.Parse(Console_.NextString());
        static string NS => Console_.NextString();
        static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();
        static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();
        static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();
        static IEnumerable<T> OrderByRand<T>(this IEnumerable<T> x) => x.OrderBy(_ => xorshift);
        static IEnumerable<T> Repeat<T>(T v, long n) => Enumerable.Repeat<T>(v, (int)n);
        static IEnumerable<int> Range(long s, long c) => Enumerable.Range((int)s, (int)c);
        static void RevSort<T>(T[] l) where T : IComparable { Array.Sort(l, (x, y) => y.CompareTo(x)); }
        static void RevSort<T>(T[] l, Comparison<T> comp) where T : IComparable { Array.Sort(l, (x, y) => comp(y, x)); }
        static IEnumerable<long> Primes(long x) { if (x < 2) yield break; yield return 2; var halfx = x / 2; var table = new bool[halfx + 1]; var max = (long)(Math.Sqrt(x) / 2); for (long i = 1; i <= max; ++i) { if (table[i]) continue; var add = 2 * i + 1; yield return add; for (long j = 2 * i * (i + 1); j <= halfx; j += add) table[j] = true; } for (long i = max + 1; i <= halfx; ++i) if (!table[i] && 2 * i + 1 <= x) yield return 2 * i + 1; }
        static IEnumerable<long> Factors(long x) { if (x < 2) yield break; while (x % 2 == 0) { x /= 2; yield return 2; } var max = (long)Math.Sqrt(x); for (long i = 3; i <= max; i += 2) while (x % i == 0) { x /= i; yield return i; } if (x != 1) yield return x; }
        static IEnumerable<long> Divisor(long x) { if (x < 1) yield break; var max = (long)Math.Sqrt(x); for (long i = 1; i <= max; ++i) { if (x % i != 0) continue; yield return i; if (i != x / i) yield return x / i; } }
        static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }
        static IEnumerator<uint> _xsi = _xsc();
        static IEnumerator<uint> _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }
        static long GCD(long a, long b) { while (b > 0) { var tmp = b; b = a % b; a = tmp; } return a; }
        static long LCM(long a, long b) => a * b / GCD(a, b);
        static Mat<T> Pow<T>(Mat<T> x, long y) => Mat<T>.Pow(x, y);
        static Mod Pow(Mod x, long y) { Mod a = 1; while (y != 0) { if ((y & 1) == 1) a.Mul(x); x.Mul(x); y >>= 1; } return a; }
        static long Pow(long x, long y) { long a = 1; while (y != 0) { if ((y & 1) == 1) a *= x; x *= x; y >>= 1; } return a; }
        static List<long> _fact = new List<long>() { 1 };
        static void _B(long n) { if (n >= _fact.Count) for (int i = _fact.Count; i <= n; ++i) _fact.Add(_fact[i - 1] * i); }
        static long Comb(long n, long k) { _B(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)] / _fact[(int)k]; }
        static long Perm(long n, long k) { _B(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)]; }
        static Func<TR> Lambda<TR>(Func<Func<TR>, TR> f) { Func<TR> t = () => default(TR); return t = () => f(t); }
        static Func<T1, TR> Lambda<T1, TR>(Func<T1, Func<T1, TR>, TR> f) { Func<T1, TR> t = x1 => default(TR); return t = x1 => f(x1, t); }
        static Func<T1, T2, TR> Lambda<T1, T2, TR>(Func<T1, T2, Func<T1, T2, TR>, TR> f) { Func<T1, T2, TR> t = (x1, x2) => default(TR); return t = (x1, x2) => f(x1, x2, t); }
        static Func<T1, T2, T3, TR> Lambda<T1, T2, T3, TR>(Func<T1, T2, T3, Func<T1, T2, T3, TR>, TR> f) { Func<T1, T2, T3, TR> t = (x1, x2, x3) => default(TR); return t = (x1, x2, x3) => f(x1, x2, x3, t); }
        static Func<T1, T2, T3, T4, TR> Lambda<T1, T2, T3, T4, TR>(Func<T1, T2, T3, T4, Func<T1, T2, T3, T4, TR>, TR> f) { Func<T1, T2, T3, T4, TR> t = (x1, x2, x3, x4) => default(TR); return t = (x1, x2, x3, x4) => f(x1, x2, x3, x4, t); }
        static List<T> LCS<T>(T[] s, T[] t) where T : IEquatable<T> { int sl = s.Length, tl = t.Length; var dp = new int[sl + 1, tl + 1]; for (var i = 0; i < sl; i++) for (var j = 0; j < tl; j++) dp[i + 1, j + 1] = s[i].Equals(t[j]) ? dp[i, j] + 1 : Max(dp[i + 1, j], dp[i, j + 1]); { var r = new List<T>(); int i = sl, j = tl; while (i > 0 && j > 0) if (s[--i].Equals(t[--j])) r.Add(s[i]); else if (dp[i, j + 1] > dp[i + 1, j]) ++j; else ++i; r.Reverse(); return r; } }
        static long LIS<T>(T[] array, bool strict) { var l = new List<T>(); foreach (var e in array) { var i = l.BinarySearch(e); if (i < 0) i = ~i; else if (!strict) ++i; if (i == l.Count) l.Add(e); else l[i] = e; } return l.Count; }
        class PQ<T> where T : IComparable
        {
            List<T> h; Comparison<T> c; public T Peek => h[0]; public int Count => h.Count;
            public PQ(int cap, Comparison<T> c, bool asc = true) { h = new List<T>(cap); this.c = asc ? c : (x, y) => c(y, x); }
            public PQ(Comparison<T> c, bool asc = true) { h = new List<T>(); this.c = asc ? c : (x, y) => c(y, x); }
            public PQ(int cap, bool asc = true) : this(cap, (x, y) => x.CompareTo(y), asc) { }
            public PQ(bool asc = true) : this((x, y) => x.CompareTo(y), asc) { }
            public void Push(T v) { var i = h.Count; h.Add(v); while (i > 0) { var ni = (i - 1) / 2; if (c(v, h[ni]) >= 0) break; h[i] = h[ni]; i = ni; } h[i] = v; }
            public T Pop() { var r = h[0]; var v = h[h.Count - 1]; h.RemoveAt(h.Count - 1); if (h.Count == 0) return r; var i = 0; while (i * 2 + 1 < h.Count) { var i1 = i * 2 + 1; var i2 = i * 2 + 2; if (i2 < h.Count && c(h[i1], h[i2]) > 0) i1 = i2; if (c(v, h[i1]) <= 0) break; h[i] = h[i1]; i = i1; } h[i] = v; return r; }
        }
        class PQ<TK, TV> where TK : IComparable
        {
            PQ<Tuple<TK, TV>> q; public Tuple<TK, TV> Peek => q.Peek; public int Count => q.Count;
            public PQ(int cap, Comparison<TK> c, bool asc = true) { q = new PQ<Tuple<TK, TV>>(cap, (x, y) => c(x.Item1, y.Item1), asc); }
            public PQ(Comparison<TK> c, bool asc = true) { q = new PQ<Tuple<TK, TV>>((x, y) => c(x.Item1, y.Item1), asc); }
            public PQ(int cap, bool asc = true) : this(cap, (x, y) => x.CompareTo(y), asc) { }
            public PQ(bool asc = true) : this((x, y) => x.CompareTo(y), asc) { }
            public void Push(TK k, TV v) => q.Push(Tuple.Create(k, v));
            public Tuple<TK, TV> Pop() => q.Pop();
        }
        public class UF
        {
            long[] d;
            public UF(long s) { d = Repeat(-1L, s).ToArray(); }
            public bool Unite(long x, long y) { x = Root(x); y = Root(y); if (x != y) { if (d[y] < d[x]) { var t = y; y = x; x = t; } d[x] += d[y]; d[y] = x; } return x != y; }
            public bool IsSame(long x, long y) => Root(x) == Root(y);
            public long Root(long x) => d[x] < 0 ? x : d[x] = Root(d[x]);
            public long Count(long x) => -d[Root(x)];
        }
        struct Mod : IEquatable<Mod>, IEquatable<long>
        {
            static public long _mod = 1000000007; long v;
            public Mod(long x) { if (x < _mod && x >= 0) v = x; else if ((v = x % _mod) < 0) v += _mod; }
            static public implicit operator Mod(long x) => new Mod(x);
            static public implicit operator long(Mod x) => x.v;
            public void Add(Mod x) { if ((v += x.v) >= _mod) v -= _mod; }
            public void Sub(Mod x) { if ((v -= x.v) < 0) v += _mod; }
            public void Mul(Mod x) => v = (v * x.v) % _mod;
            public void Div(Mod x) => v = (v * Inverse(x.v)) % _mod;
            static public Mod operator +(Mod x, Mod y) { var t = x.v + y.v; return t >= _mod ? new Mod { v = t - _mod } : new Mod { v = t }; }
            static public Mod operator -(Mod x, Mod y) { var t = x.v - y.v; return t < 0 ? new Mod { v = t + _mod } : new Mod { v = t }; }
            static public Mod operator *(Mod x, Mod y) => x.v * y.v;
            static public Mod operator /(Mod x, Mod y) => x.v * Inverse(y.v);
            static public bool operator ==(Mod x, Mod y) => x.v == y.v;
            static public bool operator !=(Mod x, Mod y) => x.v != y.v;
            static public long Inverse(long x) { long b = _mod, r = 1, u = 0, t = 0; while (b > 0) { var q = x / b; t = u; u = r - q * u; r = t; t = b; b = x - q * b; x = t; } return r < 0 ? r + _mod : r; }
            public bool Equals(Mod x) => v == x.v;
            public bool Equals(long x) => v == x;
            public override bool Equals(object x) => x == null ? false : Equals((Mod)x);
            public override int GetHashCode() => v.GetHashCode();
            public override string ToString() => v.ToString();
            static List<Mod> _fact = new List<Mod>() { 1 };
            static void B(long n) { if (n >= _fact.Count) for (int i = _fact.Count; i <= n; ++i) _fact.Add(_fact[i - 1] * i); }
            static public Mod Comb(long n, long k) { B(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)] / _fact[(int)k]; }
            static public Mod Perm(long n, long k) { B(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)]; }
        }
        struct Mat<T>
        {
            T[,] m;
            public Mat(T[,] v) { m = (T[,])v.Clone(); }
            static public implicit operator Mat<T>(T[,] v) => new Mat<T>(v);
            public T this[int r, int c] { get { return m[r, c]; } set { m[r, c] = value; } }
            static public Mat<T> operator +(Mat<T> a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] += (dynamic)x; return tm; }
            static public Mat<T> operator +(Mat<T> a, Mat<T> b) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] += (dynamic)b[r, c]; return tm; }
            static public Mat<T> operator -(Mat<T> a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] -= (dynamic)x; return tm; }
            static public Mat<T> operator -(Mat<T> a, Mat<T> b) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] -= (dynamic)b[r, c]; return tm; }
            static public Mat<T> operator *(Mat<T> a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] *= (dynamic)x; return tm; }
            static public Mat<T> operator *(Mat<T> a, Mat<T> b) { var nr = a.m.GetLength(0); var nc = b.m.GetLength(1); var tm = new T[nr, nc]; for (int i = 0; i < nr; ++i) for (int j = 0; j < nc; ++j) tm[i, j] = (dynamic)0; for (int r = 0; r < nr; ++r) for (int c = 0; c < nc; ++c) for (int i = 0; i < a.m.GetLength(1); ++i) tm[r, c] += a[r, i] * (dynamic)b[i, c]; return tm; }
            static public Mat<T> Pow(Mat<T> x, long y) { var n = x.m.GetLength(0); var t = (Mat<T>)new T[n, n]; for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) t[i, j] = (dynamic)(i == j ? 1 : 0); while (y != 0) { if ((y & 1) == 1) t *= x; x *= x; y >>= 1; } return t; }
        }
        class Tree
        {
            long N; int l; List<long>[] p; int[] d; long[][] pr; long r; Tuple<long, long, int>[] e; Tuple<long, long>[] b; bool lca; bool euler; bool bfs;
            public Tree(List<long>[] p_, long r_) { N = p_.Length; p = p_; r = r_; lca = false; euler = false; }
            public Tuple<long, long>[] BFSRoot() { if (!bfs) { var nb = new List<Tuple<long, long>>(); var q = new Queue<long>(); var d = new bool[N]; nb.Add(Tuple.Create(r, -1L)); d[r] = true; q.Enqueue(r); while (q.Count > 0) { var w = q.Dequeue(); foreach (var i in p[w]) { if (d[i]) continue; d[i] = true; q.Enqueue(i); nb.Add(Tuple.Create(i, w)); } } b = nb.ToArray(); bfs = true; } return b; }
            public Tuple<long, long>[] BFSLeaf() => BFSRoot().Reverse().ToArray();
            public Tuple<long, long, int>[] Euler() { if (!euler) { var ne = new List<Tuple<long, long, int>>(); var s = new Stack<Tuple<long, long>>(); var d = new bool[N]; d[r] = true; s.Push(Tuple.Create(r, -1L)); while (s.Count > 0) { var w = s.Peek(); var ad = true; foreach (var i in p[w.Item1]) { if (d[i]) continue; d[i] = true; ad = false; s.Push(Tuple.Create(i, w.Item1)); } if (!ad || p[w.Item1].Count == 1) ne.Add(Tuple.Create(w.Item1, w.Item2, 1)); if (ad) { s.Pop(); ne.Add(Tuple.Create(w.Item1, w.Item2, -1)); } } e = ne.ToArray(); euler = true; } return e; }
            public long LCA(long u, long v) { if (!lca) { l = 0; while (N > (1 << l)) l++; d = new int[N]; pr = Repeat(0, l).Select(_ => new long[N]).ToArray(); d[r] = 0; pr[0][r] = -1; var q = new Stack<long>(); q.Push(r); while (q.Count > 0) { var w = q.Pop(); foreach (var i in p[w]) { if (i == pr[0][w]) continue; q.Push(i); d[i] = d[w] + 1; pr[0][i] = w; } } for (var k = 0; k + 1 < l; k++) for (var w = 0; w < N; w++) if (pr[k][w] < 0) pr[k + 1][w] = -1; else pr[k + 1][w] = pr[k][pr[k][w]]; lca = true; } if (d[u] > d[v]) { var t = u; u = v; v = t; } for (var k = 0; k < l; k++) if ((((d[v] - d[u]) >> k) & 1) != 0) v = pr[k][v]; if (u == v) return u; for (var k = l - 1; k >= 0; k--) if (pr[k][u] != pr[k][v]) { u = pr[k][u]; v = pr[k][v]; } return pr[0][u]; }
        }
        class Graph
        {
            int n; List<Tuple<int, int, long>> pathList; Dictionary<int, long>[] vtxPath; long INF = (long.MaxValue >> 1) - 1;
            public Graph(long _n)
            {
                n = (int)_n;
                pathList = new List<Tuple<int, int, long>>();
                vtxPath = Repeat(0, n).Select(_ => new Dictionary<int, long>()).ToArray();
            }
            public void AddPath(long a, long b, long c)
            {
                pathList.Add(Tuple.Create((int)a, (int)b, c));
                vtxPath[a][(int)b] = vtxPath[a].ContainsKey((int)b) ? Min(vtxPath[a][(int)b], c) : c;
            }
            public long[,] WarshallFloyd()
            {
                var ret = new long[n, n];
                for (var i = 0; i < n; i++)
                    for (var j = 0; j < n; j++)
                        ret[i, j] = vtxPath[i].ContainsKey(j) ? vtxPath[i][j] : INF;
                for (var k = 0; k < n; k++)
                    for (var i = 0; i < n; i++)
                        for (var j = 0; j < n; j++)
                            ret[i, j] = Min(ret[i, j], ret[i, k] + ret[k, j]);
                return ret;
            }
            public Tuple<long[], int?[], bool[]> BellmanFord(long s)
            {
                var dist = Repeat(INF, n).ToArray();
                var pred = new int?[n];
                var neg = new bool[n];
                dist[s] = 0;
                for (var i = 1; i < n; i++)
                    foreach (var path in pathList)
                        if (dist[path.Item2] > (dist[path.Item1] == INF ? INF : dist[path.Item1] + path.Item3))
                        {
                            dist[path.Item2] = dist[path.Item1] + path.Item3;
                            pred[path.Item2] = path.Item1;
                        }
                for (var i = 0; i < n; i++)
                    foreach (var path in pathList)
                        if (dist[path.Item2] > (dist[path.Item1] == INF ? INF : dist[path.Item1] + path.Item3) || neg[path.Item1])
                        {
                            dist[path.Item2] = dist[path.Item1] + path.Item3;
                            neg[path.Item2] = true;
                        }
                return Tuple.Create(dist, pred, neg);
            }
            public Tuple<long[], int?[]> Dijkstra(long s)
            {
                var dist = Repeat(long.MaxValue >> 2, n).ToArray();
                var pred = new int?[n];
                dist[s] = 0;
                var q = new PQ<long, int>();
                q.Push(0, (int)s);
                while (q.Count > 0)
                {
                    var u = q.Pop().Item2;
                    foreach (var path in vtxPath[u])
                    {
                        var v = path.Key;
                        var alt = dist[u] + path.Value;
                        if (dist[v] > alt)
                        {
                            dist[v] = alt;
                            pred[v] = u;
                            q.Push(alt, v);
                        }
                    }
                }
                return Tuple.Create(dist, pred);
            }
        }
        class BT<T> where T : IComparable
        {
            class Node { public Node l; public Node r; public T v; public bool b; public int c; }
            Comparison<T> c; Node r; bool ch; T lm;
            public BT(Comparison<T> _c) { c = _c; }
            public BT() : this((x, y) => x.CompareTo(y)) { }
            bool R(Node n) => n != null && !n.b;
            bool B(Node n) => n != null && n.b;
            long C(Node n) => n?.c ?? 0;
            Node RtL(Node n) { Node m = n.r, t = m.l; m.l = n; n.r = t; n.c -= m.c - (t?.c ?? 0); m.c += n.c - (t?.c ?? 0); return m; }
            Node RtR(Node n) { Node m = n.l, t = m.r; m.r = n; n.l = t; n.c -= m.c - (t?.c ?? 0); m.c += n.c - (t?.c ?? 0); return m; }
            Node RtLR(Node n) { n.l = RtL(n.l); return RtR(n); }
            Node RtRL(Node n) { n.r = RtR(n.r); return RtL(n); }
            public void Add(T x) { r = A(r, x); r.b = true; }
            Node A(Node n, T x) { if (n == null) { ch = true; return new Node() { v = x, c = 1 }; } if (c(x, n.v) < 0) n.l = A(n.l, x); else n.r = A(n.r, x); n.c++; return Bl(n); }
            Node Bl(Node n) { if (!ch) return n; if (!B(n)) return n; if (R(n.l) && R(n.l.l)) { n = RtR(n); n.l.b = true; } else if (R(n.l) && R(n.l.r)) { n = RtLR(n); n.l.b = true; } else if (R(n.r) && R(n.r.l)) { n = RtRL(n); n.r.b = true; } else if (R(n.r) && R(n.r.r)) { n = RtL(n); n.r.b = true; } else ch = false; return n; }
            public void Remove(T x) { r = Rm(r, x); if (r != null) r.b = true; }
            Node Rm(Node n, T x) { if (n == null) { ch = false; return n; } n.c--; var r = c(x, n.v); if (r < 0) { n.l = Rm(n.l, x); return BlL(n); } if (r > 0) { n.r = Rm(n.r, x); return BlR(n); } if (n.l == null) { ch = n.b; return n.r; } n.l = RmM(n.l); n.v = lm; return BlL(n); }
            Node RmM(Node n) { n.c--; if (n.r != null) { n.r = RmM(n.r); return BlR(n); } lm = n.v; ch = n.b; return n.l; }
            Node BlL(Node n) { if (!ch) return n; if (B(n.r) && R(n.r.l)) { var b = n.b; n = RtRL(n); n.b = b; n.l.b = true; ch = false; } else if (B(n.r) && R(n.r.r)) { var b = n.b; n = RtL(n); n.b = b; n.r.b = true; n.l.b = true; ch = false; } else if (B(n.r)) { ch = n.b; n.b = true; n.r.b = false; } else { n = RtL(n); n.b = true; n.l.b = false; n.l = BlL(n.l); ch = false; } return n; }
            Node BlR(Node n) { if (!ch) return n; if (B(n.l) && R(n.l.r)) { var b = n.b; n = RtLR(n); n.b = b; n.r.b = true; ch = false; } else if (B(n.l) && R(n.l.l)) { var b = n.b; n = RtR(n); n.b = b; n.l.b = true; n.r.b = true; ch = false; } else if (B(n.l)) { ch = n.b; n.b = true; n.l.b = false; } else { n = RtR(n); n.b = true; n.r.b = false; n.r = BlR(n.r); ch = false; } return n; }
            public T this[long i] { get { return At(r, i); } }
            T At(Node n, long i) { if (n == null) return default(T); if (n.l == null) if (i == 0) return n.v; else return At(n.r, i - 1); if (n.l.c == i) return n.v; if (n.l.c > i) return At(n.l, i); return At(n.r, i - n.l.c - 1); }
            public bool Have(T x) { var t = FindUpper(x); return t < C(r) && At(r, t).CompareTo(x) == 0; }
            public long FindUpper(T x, bool allowSame = true) => allowSame ? FL(r, x) + 1 : FU(r, x);
            long FU(Node n, T x) { if (n == null) return 0; var r = c(x, n.v); if (r < 0) return FU(n.l, x); return C(n.l) + 1 + FU(n.r, x); }
            public long FindLower(T x, bool allowSame = true) { var t = FL(r, x); if (allowSame) return t + 1 < C(r) && At(r, t + 1).CompareTo(x) == 0 ? t + 1 : t < 0 ? C(r) : t; return t < 0 ? C(r) : t; }
            long FL(Node n, T x) { if (n == null) return -1; var r = c(x, n.v); if (r > 0) return C(n.l) + 1 + FL(n.r, x); return FL(n.l, x); }
            public T Min() { Node n = r, p = null; while (n != null) { p = n; n = n.l; } return p == null ? default(T) : p.v; }
            public T Max() { Node n = r, p = null; while (n != null) { p = n; n = n.r; } return p == null ? default(T) : p.v; }
            public bool Any() => r != null;
            public long Count() => C(r);
            public IEnumerable<T> List() => L(r);
            IEnumerable<T> L(Node n) { if (n == null) yield break; foreach (var i in L(n.l)) yield return i; yield return n.v; foreach (var i in L(n.r)) yield return i; }
        }
        class Dict<K, V> : Dictionary<K, V>
        {
            Func<K, V> d;
            public Dict(Func<K, V> _d) { d = _d; }
            public Dict() : this(_ => default(V)) { }
            new public V this[K i] { get { V v; return TryGetValue(i, out v) ? v : base[i] = d(i); } set { base[i] = value; } }
        }
        class Deque<T>
        {
            T[] b; int o, c;
            public int Count;
            public T this[int i] { get { return b[gi(i)]; } set { b[gi(i)] = value; } }
            public Deque(int cap = 16) { b = new T[c = cap]; }
            int gi(int i) { if (i >= c) throw new Exception(); var r = o + i; return r >= c ? r - c : r; }
            public void PushFront(T x) { if (Count == c) e(); if (--o < 0) o += b.Length; b[o] = x; ++Count; }
            public T PopFront() { if (Count-- == 0) throw new Exception(); var r = b[o++]; if (o >= c) o -= c; return r; }
            public T Front => b[o];
            public void PushBack(T x) { if (Count == c) e(); var i = o + Count++; b[i >= c ? i - c : i] = x; }
            public T PopBack() { if (Count == 0) throw new Exception(); return b[gi(--Count)]; }
            public T Back => b[gi(Count - 1)];
            void e() { T[] nb = new T[c << 1]; if (o > c - Count) { var l = b.Length - o; Array.Copy(b, o, nb, 0, l); Array.Copy(b, 0, nb, l, Count - l); } else Array.Copy(b, o, nb, 0, Count); b = nb; o = 0; c <<= 1; }
            public void Insert(int i, T x) { if (i > Count) throw new Exception(); this.PushFront(x); for (int j = 0; j < i; j++) this[j] = this[j + 1]; this[i] = x; }
            public T RemoveAt(int i) { if (i < 0 || i >= Count) throw new Exception(); var r = this[i]; for (int j = i; j > 0; j--) this[j] = this[j - 1]; this.PopFront(); return r; }
        }
        class SegTree<T>
        {
            int n; T ti; Func<T, T, T> f; T[] dat;
            public SegTree(long _n, T _ti, Func<T, T, T> _f) { n = 1; while (n < _n) n <<= 1; ti = _ti; f = _f; dat = Repeat(ti, n << 1).ToArray(); for (var i = n - 1; i > 0; i--) dat[i] = f(dat[(i << 1) | 0], dat[(i << 1) | 1]); }
            public SegTree(List<T> l, T _ti, Func<T, T, T> _f) : this(l.Count, _ti, _f) { for (var i = 0; i < l.Count; i++) dat[n + i] = l[i]; for (var i = n - 1; i > 0; i--) dat[i] = f(dat[(i << 1) | 0], dat[(i << 1) | 1]); }
            public void Update(long i, T v) { dat[i += n] = v; while ((i >>= 1) > 0) dat[i] = f(dat[(i << 1) | 0], dat[(i << 1) | 1]); }
            public T Query(long l, long r) { var vl = ti; var vr = ti; for (long li = n + l, ri = n + r; li < ri; li >>= 1, ri >>= 1) { if ((li & 1) == 1) vl = f(vl, dat[li++]); if ((ri & 1) == 1) vr = f(dat[--ri], vr); } return f(vl, vr); }
            public T this[long idx] { get { return dat[idx + n]; } set { Update(idx, value); } }
        }
        class LazySegTree<T, E>
        {
            int n, height; T ti; E ei; Func<T, T, T> f; Func<T, E, T> g; Func<E, E, E> h; T[] dat; E[] laz;
            public LazySegTree(long _n, T _ti, E _ei, Func<T, T, T> _f, Func<T, E, T> _g, Func<E, E, E> _h) { n = 1; height = 0; while (n < _n) { n <<= 1; ++height; } ti = _ti; ei = _ei; f = _f; g = _g; h = _h; dat = Repeat(ti, n << 1).ToArray(); laz = Repeat(ei, n << 1).ToArray(); for (var i = n - 1; i > 0; i--) dat[i] = f(dat[(i << 1) | 0], dat[(i << 1) | 1]); }
            public LazySegTree(List<T> l, T _ti, E _ei, Func<T, T, T> _f, Func<T, E, T> _g, Func<E, E, E> _h) : this(l.Count, _ti, _ei, _f, _g, _h) { for (var i = 0; i < l.Count; i++) dat[n + i] = l[i]; for (var i = n - 1; i > 0; i--) dat[i] = f(dat[(i << 1) | 0], dat[(i << 1) | 1]); }
            T Reflect(long i) => laz[i].Equals(ei) ? dat[i] : g(dat[i], laz[i]);
            void Eval(long i) { if (laz[i].Equals(ei)) return; laz[(i << 1) | 0] = h(laz[(i << 1) | 0], laz[i]); laz[(i << 1) | 1] = h(laz[(i << 1) | 1], laz[i]); dat[i] = Reflect(i); laz[i] = ei; }
            void Thrust(long i) { for (var j = height; j > 0; j--) Eval(i >> j); }
            void Recalc(long i) { while ((i >>= 1) > 0) dat[i] = f(Reflect((i << 1) | 0), Reflect((i << 1) | 1)); }
            public void Update(long l, long r, E v) { Thrust(l += n); Thrust(r += n - 1); for (long li = l, ri = r + 1; li < ri; li >>= 1, ri >>= 1) { if ((li & 1) == 1) { laz[li] = h(laz[li], v); ++li; } if ((ri & 1) == 1) { --ri; laz[ri] = h(laz[ri], v); } } Recalc(l); Recalc(r); }
            public T Query(long l, long r) { Thrust(l += n); Thrust(r += n - 1); var vl = ti; var vr = ti; for (long li = l, ri = r + 1; li < ri; li >>= 1, ri >>= 1) { if ((li & 1) == 1) vl = f(vl, Reflect(li++)); if ((ri & 1) == 1) vr = f(Reflect(--ri), vr); } return f(vl, vr); }
            public T this[long idx] { get { Thrust(idx += n); return dat[idx] = Reflect(idx); } set { Thrust(idx += n); dat[idx] = value; laz[idx] = ei; Recalc(idx); } }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _630C
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            long sum = 0;
            for (int i = 0; i < n; i++)
            {
                sum +=Convert.ToInt32( Math.Pow(2, i+1));
            }
            Console.WriteLine(sum);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

// (づ°ω°)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    int Gcd(int a, int b)
    {
        if (b == 0)
            return a;
        return Gcd(b, a % b);
    }

    private const int SIEVE_SIZE = 1000010;
    private readonly bool[] isComposite = new bool[SIEVE_SIZE + 1];
    private readonly IList<int> primes = new List<int>();
    void Sieve()
    {
        for (int i = 2; i * i <= SIEVE_SIZE; i++)
            if (!isComposite[i])
                for (int j = i * i; j <= SIEVE_SIZE; j += i)
                    isComposite[j] = true;
        for (int i = 2; i <= SIEVE_SIZE; i++)
            if (!isComposite[i])
                primes.Add(i);
    }

    public void Solve()
    {
        Sieve();

        long a = ReadLong();
        if (a == 1)
        {
            Write(1);
            return;
        }
        var d = new SDictionary<long, int> { { a, 1 } };
        int ans = 0;
        var ts = DateTime.Now;
        for (int i = 0; i < primes.Count; i++)
        {
            var toAdd = new List<Tuple<long, int>>();
            var toRemove = new List<long>();
            foreach (var p in d)
            {
                if (p.Key <= primes[i])
                    toRemove.Add(p.Key);
                for (long x = primes[i]; x < p.Key; x *= primes[i])
                    if (p.Key % (x + 1) == 0)
                    {
                        long y = p.Key / (x + 1);
                        if (y == 1)
                            ans += p.Value;
                        else if (y > primes[i] && y % 2 == 0)
                            toAdd.Add(Tuple.Create(y, p.Value));
                    }
            }
            foreach (int x in toRemove)
                d.Remove(x);
            foreach (var p in toAdd)
                d[p.Item1] += p.Item2;
        }
        //Write((DateTime.Now - ts).TotalMilliseconds);

        foreach (var p in d)
            if (p.Key > SIEVE_SIZE)
            {
                long x = p.Key - 1;
                bool ok = true;
                for (int i = 0; ok && 1L * primes[i] * primes[i] <= x; i++)
                    if (x % primes[i] == 0)
                        ok = false;
                if (ok)
                    ans += p.Value;
            }

        Write(ans);
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("hull.in");
        //writer = new StreamWriter("hull.out");
#endif
        try
        {
//            var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
//            thread.Start();
//            thread.Join();
            new Solver().Solve();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
#if DEBUG
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write
    private static Queue<string> currentLineTokens = new Queue<string>();
    private static string[] ReadAndSplitLine() {return reader.ReadLine().Split(new[] { ' ', '\t', '-' }, StringSplitOptions.RemoveEmptyEntries);}
    public static string ReadToken(){while (currentLineTokens.Count == 0)currentLineTokens = new Queue<string>(ReadAndSplitLine());return currentLineTokens.Dequeue();}
    public static int ReadInt(){return int.Parse(ReadToken());}
    public static long ReadLong(){return long.Parse(ReadToken());}
    public static double ReadDouble(){return double.Parse(ReadToken(), CultureInfo.InvariantCulture);}
    public static int[] ReadIntArray(){return ReadAndSplitLine().Select(int.Parse).ToArray();}
    public static long[] ReadLongArray(){return ReadAndSplitLine().Select(long.Parse).ToArray();}
    public static double[] ReadDoubleArray(){return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();}
    public static int[][] ReadIntMatrix(int numberOfRows){int[][] matrix = new int[numberOfRows][];for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray();return matrix;}
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows){int[][] matrix = ReadIntMatrix(numberOfRows);int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++){ret[i] = new int[numberOfRows];for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i];}return ret;}
    public static string[] ReadLines(int quantity){string[] lines = new string[quantity];for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim();return lines;}
    public static void WriteArray<T>(IEnumerable<T> array){writer.WriteLine(string.Join(" ", array));}
    public static void Write(params object[] array){WriteArray(array);}
    public static void WriteLines<T>(IEnumerable<T> array){foreach (var a in array)writer.WriteLine(a);}
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>{public new TValue this[TKey key]{
        get { return ContainsKey(key) ? base[key] : default(TValue); }set { base[key] = value; }}}
    private static T[] Init<T>(int size) where T : new(){var ret = new T[size];for (int i = 0; i < size; i++)ret[i] = new T();return ret;}
    #endregion
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

// (づ°ω°)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    int Gcd(int a, int b)
    {
        if (b == 0)
            return a;
        return Gcd(b, a % b);
    }

    private const int SIEVE_SIZE = 1000010;
    private readonly bool[] isComposite = new bool[SIEVE_SIZE + 1];
    private readonly IList<int> primes = new List<int>();
    void Sieve()
    {
        for (int i = 2; i * i <= SIEVE_SIZE; i++)
            if (!isComposite[i])
                for (int j = i * i; j <= SIEVE_SIZE; j += i)
                    isComposite[j] = true;
        for (int i = 2; i <= SIEVE_SIZE; i++)
            if (!isComposite[i])
                primes.Add(i);
    }

    Dictionary<Tuple<long, int>, int> mem = new Dictionary<Tuple<long, int>, int>();
    int Fun(long x, int y)
    {
        if (x == 1)
            return 1;
        var key = Tuple.Create(x, y);
        if (mem.ContainsKey(key))
        {
            Write("hit");
            return mem[key];
        }
        int ret = 0;
        for (int i = y; i < primes.Count && primes[i] < x; i++)
        {
            for (long j = primes[i]; j < x; j *= primes[i])
                if (x % (j + 1) == 0)
                    ret += Fun(x / (j + 1), i + 1);
        }

        return mem[key] = ret;
    }

    public void Solve()
    {
        Sieve();

        long a = ReadLong();
        var d = new SDictionary<long, int> { { a, 1 } };
        int ans = 0;
        for (int i = 0; i < primes.Count; i++)
        {
            var toAdd = new List<Tuple<long, int>>();
            var toRemove = new List<long>();
            foreach (var p in d)
            {
                if (p.Key <= primes[i])
                    toRemove.Add(p.Key);
                for (long x = primes[i]; x < p.Key; x *= primes[i])
                    if (p.Key % (x + 1) == 0)
                    {
                        long y = p.Key / (x + 1);
                        if (y == 1)
                            ans += p.Value;
                        else if (y > primes[i])
                            toAdd.Add(Tuple.Create(p.Key / (x + 1), p.Value));
                    }
            }
            foreach (var p in toAdd)
                d[p.Item1] += p.Item2;
            foreach (int x in toRemove)
                d.Remove(x);
        }

        foreach (var p in d)
            if (p.Key > SIEVE_SIZE)
            {
                long x = p.Key - 1;
                bool ok = true;
                for (int i = 0; ok && 1L * primes[i] * primes[i] <= x; i++)
                    if (x % primes[i] == 0)
                        ok = false;
                if (ok)
                    ans += p.Value;
            }

        Write(ans);
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("hull.in");
        //writer = new StreamWriter("hull.out");
#endif
        try
        {
//            var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
//            thread.Start();
//            thread.Join();
            new Solver().Solve();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
#if DEBUG
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write
    private static Queue<string> currentLineTokens = new Queue<string>();
    private static string[] ReadAndSplitLine() {return reader.ReadLine().Split(new[] { ' ', '\t', '-' }, StringSplitOptions.RemoveEmptyEntries);}
    public static string ReadToken(){while (currentLineTokens.Count == 0)currentLineTokens = new Queue<string>(ReadAndSplitLine());return currentLineTokens.Dequeue();}
    public static int ReadInt(){return int.Parse(ReadToken());}
    public static long ReadLong(){return long.Parse(ReadToken());}
    public static double ReadDouble(){return double.Parse(ReadToken(), CultureInfo.InvariantCulture);}
    public static int[] ReadIntArray(){return ReadAndSplitLine().Select(int.Parse).ToArray();}
    public static long[] ReadLongArray(){return ReadAndSplitLine().Select(long.Parse).ToArray();}
    public static double[] ReadDoubleArray(){return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();}
    public static int[][] ReadIntMatrix(int numberOfRows){int[][] matrix = new int[numberOfRows][];for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray();return matrix;}
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows){int[][] matrix = ReadIntMatrix(numberOfRows);int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++){ret[i] = new int[numberOfRows];for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i];}return ret;}
    public static string[] ReadLines(int quantity){string[] lines = new string[quantity];for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim();return lines;}
    public static void WriteArray<T>(IEnumerable<T> array){writer.WriteLine(string.Join(" ", array));}
    public static void Write(params object[] array){WriteArray(array);}
    public static void WriteLines<T>(IEnumerable<T> array){foreach (var a in array)writer.WriteLine(a);}
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>{public new TValue this[TKey key]{
        get { return ContainsKey(key) ? base[key] : default(TValue); }set { base[key] = value; }}}
    private static T[] Init<T>(int size) where T : new(){var ret = new T[size];for (int i = 0; i < size; i++)ret[i] = new T();return ret;}
    #endregion
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Threading;
using System.Runtime.CompilerServices;
using System.Text;
using System.Diagnostics;
using System.Numerics;
using static System.Console;
using static System.Convert;
using static System.Math;
using static Template;
using Pi = Pair<int, int>;

class Solver
{
    public Scanner sc;
    public void Solve()
    {
        int N, M;
        sc.Make(out N, out M);
        var A = sc.ArrInt;
        var L = Create(2, () => new HashSet<int>());
        for(int k = 0; k < 2; k++)
        {
            int[] a;
            if (k == 0) a = A.Take(N / 2).ToArray();
            else a = A.Skip(N / 2).ToArray();
            for(int j = 0; j < (1 << a.Length); j++)
            {
                var sum = 0;
                for (int l = 0; l < a.Length; l++)
                    if ((1 & j >> l) == 1) { sum += a[l]; if (sum >= M) sum -= M; }
                L[k].Add(sum);
            }
        }
        var dat = Create(2, id => {
            var r = new int[L[id].Count];
            var now = 0;
            foreach (var d in L[id]) r[now++] = d;
            Array.Sort(r);
            return r;
        });
        var max = 0;
        var idx = 0;
        for(int i = 0; i < dat[0].Length; i++)
        {
            while ((dat[1][(idx + 1) % dat[1].Length] + dat[0][i]) % M > (dat[1][idx] + dat[0][i]) % M)
            {
                idx++;if (idx >= dat[1].Length) idx -= dat[1].Length;
            }
            chmax(ref max, (dat[1][idx] + dat[0][i]) % M);
        }
        Console.WriteLine(max);
    }
}

#region Template
public static class Template
{
    static void Main(string[] args)
    {
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        var sol = new Solver() { sc = new Scanner() };
        //var th = new Thread(sol.Solve, 1 << 26);th.Start();th.Join();
        sol.Solve();
        Console.Out.Flush();
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(ref T a, ref T b) { var t = b; b = a; a = t; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(this IList<T> A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }
    public static T[] Create<T>(int n, Func<T> f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }
    public static T[] Create<T>(int n, Func<int, T> f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }
    public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> A) => A.OrderBy(v => Guid.NewGuid());
    public static int CompareTo<T>(this T[] A, T[] B, Comparison<T> cmp = null) { cmp = cmp ?? Comparer<T>.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }
    public static int MaxElement<T>(this IList<T> A, Comparison<T> cmp = null) { cmp = cmp ?? Comparer<T>.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }
    public static T PopBack<T>(this List<T> A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }
    public static void Fail<T>(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }
}
public class Scanner
{
    public string Str => Console.ReadLine().Trim();
    public int Int => int.Parse(Str);
    public long Long => long.Parse(Str);
    public double Double => double.Parse(Str);
    public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();
    public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();
    public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());
    public int[] ArrInt1D(int n) => Create(n, () => Int);
    public long[] ArrLong1D(int n) => Create(n, () => Long);
    public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);
    public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);
    private Queue<string> q = new Queue<string>();
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public T Next<T>() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }
    public void Make<T1>(out T1 v1) => v1 = Next<T1>();
    public void Make<T1, T2>(out T1 v1, out T2 v2) { v1 = Next<T1>(); v2 = Next<T2>(); }
    public void Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next<T3>(); }
    public void Make<T1, T2, T3, T4>(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next<T4>(); }
    public void Make<T1, T2, T3, T4, T5>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next<T5>(); }
    public void Make<T1, T2, T3, T4, T5, T6>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next<T6>(); }
    public void Make<T1, T2, T3, T4, T5, T6, T7>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6, out T7 v7) { Make(out v1, out v2, out v3, out v4, out v5, out v6); v7 = Next<T7>(); }
    //public (T1, T2) Make<T1, T2>() { Make(out T1 v1, out T2 v2); return (v1, v2); }
    //public (T1, T2, T3) Make<T1, T2, T3>() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }
    //public (T1, T2, T3, T4) Make<T1, T2, T3, T4>() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }
}
public class Pair<T1, T2> : IComparable<Pair<T1, T2>>
{
    public T1 v1;
    public T2 v2;
    public Pair() { }
    public Pair(T1 v1, T2 v2)
    { this.v1 = v1; this.v2 = v2; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2> p)
    {
        var c = Comparer<T1>.Default.Compare(v1, p.v1);
        if (c == 0)
            c = Comparer<T2>.Default.Compare(v2, p.v2);
        return c;
    }
    public override string ToString() => $"{v1.ToString()} {v2.ToString()}";
    public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }
}

public class Pair<T1, T2, T3> : Pair<T1, T2>, IComparable<Pair<T1, T2, T3>>
{
    public T3 v3;
    public Pair() : base() { }
    public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)
    { this.v3 = v3; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2, T3> p)
    {
        var c = base.CompareTo(p);
        if (c == 0)
            c = Comparer<T3>.Default.Compare(v3, p.v3);
        return c;
    }
    public override string ToString() => $"{base.ToString()} {v3.ToString()}";
    public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }
}
#endregion


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Threading;
using System.Runtime.CompilerServices;
using System.Text;
using System.Diagnostics;
using System.Numerics;
using static System.Console;
using static System.Convert;
using static System.Math;
using static Template;
using Pi = Pair<int, int>;

class Solver
{
    public Scanner sc;
    public void Solve()
    {
        int N, M;
        sc.Make(out N, out M);
        var A = sc.ArrInt;
        var L = Create(2, () => new HashSet<int>());
        for(int k = 0; k < 2; k++)
        {
            int[] a;
            if (k == 0) a = A.Take(N / 2).ToArray();
            else a = A.Skip(N / 2).ToArray();
            for(int j = 0; j < (1 << a.Length); j++)
            {
                var sum = 0;
                for (int l = 0; l < a.Length; l++)
                    if ((1 & j >> l) == 1) { sum += a[l]%M; if (sum >= M) sum -= M; }
                L[k].Add(sum);
            }
        }
        var dat = Create(2, id => {
            var r = new int[L[id].Count];
            var now = 0;
            foreach (var d in L[id]) r[now++] = d;
            Array.Sort(r);
            return r;
        });
        var max = 0;
        var idx = 0;
        for(int i = 0; i < dat[0].Length; i++)
        {
            while ((dat[1][(idx + 1) % dat[1].Length] + dat[0][i]) % M > (dat[1][idx] + dat[0][i]) % M)
            {
                idx++;if (idx >= dat[1].Length) idx -= dat[1].Length;
            }
            chmax(ref max, (dat[1][idx] + dat[0][i]) % M);
        }
        Console.WriteLine(max);
    }
}

#region Template
public static class Template
{
    static void Main(string[] args)
    {
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        var sol = new Solver() { sc = new Scanner() };
        //var th = new Thread(sol.Solve, 1 << 26);th.Start();th.Join();
        sol.Solve();
        Console.Out.Flush();
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(ref T a, ref T b) { var t = b; b = a; a = t; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(this IList<T> A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }
    public static T[] Create<T>(int n, Func<T> f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }
    public static T[] Create<T>(int n, Func<int, T> f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }
    public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> A) => A.OrderBy(v => Guid.NewGuid());
    public static int CompareTo<T>(this T[] A, T[] B, Comparison<T> cmp = null) { cmp = cmp ?? Comparer<T>.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }
    public static int MaxElement<T>(this IList<T> A, Comparison<T> cmp = null) { cmp = cmp ?? Comparer<T>.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }
    public static T PopBack<T>(this List<T> A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }
    public static void Fail<T>(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }
}
public class Scanner
{
    public string Str => Console.ReadLine().Trim();
    public int Int => int.Parse(Str);
    public long Long => long.Parse(Str);
    public double Double => double.Parse(Str);
    public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();
    public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();
    public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());
    public int[] ArrInt1D(int n) => Create(n, () => Int);
    public long[] ArrLong1D(int n) => Create(n, () => Long);
    public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);
    public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);
    private Queue<string> q = new Queue<string>();
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public T Next<T>() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }
    public void Make<T1>(out T1 v1) => v1 = Next<T1>();
    public void Make<T1, T2>(out T1 v1, out T2 v2) { v1 = Next<T1>(); v2 = Next<T2>(); }
    public void Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next<T3>(); }
    public void Make<T1, T2, T3, T4>(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next<T4>(); }
    public void Make<T1, T2, T3, T4, T5>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next<T5>(); }
    public void Make<T1, T2, T3, T4, T5, T6>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next<T6>(); }
    public void Make<T1, T2, T3, T4, T5, T6, T7>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6, out T7 v7) { Make(out v1, out v2, out v3, out v4, out v5, out v6); v7 = Next<T7>(); }
    //public (T1, T2) Make<T1, T2>() { Make(out T1 v1, out T2 v2); return (v1, v2); }
    //public (T1, T2, T3) Make<T1, T2, T3>() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }
    //public (T1, T2, T3, T4) Make<T1, T2, T3, T4>() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }
}
public class Pair<T1, T2> : IComparable<Pair<T1, T2>>
{
    public T1 v1;
    public T2 v2;
    public Pair() { }
    public Pair(T1 v1, T2 v2)
    { this.v1 = v1; this.v2 = v2; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2> p)
    {
        var c = Comparer<T1>.Default.Compare(v1, p.v1);
        if (c == 0)
            c = Comparer<T2>.Default.Compare(v2, p.v2);
        return c;
    }
    public override string ToString() => $"{v1.ToString()} {v2.ToString()}";
    public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }
}

public class Pair<T1, T2, T3> : Pair<T1, T2>, IComparable<Pair<T1, T2, T3>>
{
    public T3 v3;
    public Pair() : base() { }
    public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)
    { this.v3 = v3; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2, T3> p)
    {
        var c = base.CompareTo(p);
        if (c == 0)
            c = Comparer<T3>.Default.Compare(v3, p.v3);
        return c;
    }
    public override string ToString() => $"{base.ToString()} {v3.ToString()}";
    public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }
}
#endregion


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = Convert.ToInt32(Console.ReadLine());

            string aa = Console.ReadLine();

            char[] array = new char[aa.Length];

            int a = aa.Length;
            int b = 0;
            while (b < a)
            {
                array[b] = aa[b];
                b++;
            }

            int x = 0;
            int y = 0;
            int z = 0;
            int c = 0;
            while (z < aa.Length)
            {
                //Console.WriteLine("fAS");
                if (array[z] == 'L')
                {
                    x--;
                }
                if (array[z] == 'D')
                {
                    y--;
                }
                if (array[z] == 'U')
                {
                    y++;
                }
                if (array[z] == 'R')
                {
                    x++;
                }
                if(x==0&& y == 0)
                {
                    c = z + 1;
                }
                z++;
            }

            Console.WriteLine(c);
            //Console.ReadLine();

        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Codeforces
{
   class B
   {
      static void Main(string[] args)
      {
        int n = int.Parse(Console.ReadLine());
        string s = Console.ReadLine();

        int x = 0,y=0,ans=0;
        for(int i=0;i<n;i++){
          if(s[i]=='U'){
            y++;
          }else if(s[i]=='D'){
            y--;
          }else if(s[i]=='R'){
            x++;
          }else if(s[i]=='L'){
            x--;
          }
          ans++;
          if(x==0&&y==0){
            Console.WriteLine(ans);
            return;
          }
        }
        Console.WriteLine(0);

      }
   }
}


using System;
using System.Collections;
using System.Collections.Generic;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){

		int INF=(int)1e9;
		int min=INF;

		for(int hp=0;hp<=210;hp++){
			for(int at=0;at<=210;at++){
				if(AT[0]+at<=DF[1])continue;
				for(int df=0;df<=210;df++){
					int limit=INF;
					if(AT[1]>DF[0]+df){
						limit=(HP[0]+hp)/(AT[1]-(DF[0]+df));
						if((HP[0]+hp)%(AT[1]-(DF[0]+df))==0)limit--;
					}
					if(limit<=0)continue;
					int kill=HP[1]/(AT[0]+at-DF[1]);
					if(HP[1]%(AT[0]+at-DF[1])!=0)kill++;
					if(kill>0&& limit>0 && kill<=limit){
						min=Math.Min(H*hp+A*at+D*df,min);
					}
				}
			}
		}

		Console.WriteLine(min);

	}
	int[] HP;
	int[] AT;
	int[] DF;
	int H;int A;int D;
	public Sol(){
		HP=new int[2];
		AT=new int[2];
		DF=new int[2];
		var d=ria();
		HP[0]=d[0];AT[0]=d[1];DF[0]=d[2];
		d=ria();
		HP[1]=d[0];AT[1]=d[1];DF[1]=d[2];
		d=ria();
		H=d[0];A=d[1];D=d[2];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}


using System;
using System.Collections;
using System.Collections.Generic;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){

		int INF=(int)1e9;
		int min=INF;

		for(int hp=0;hp<=210;hp++){
			for(int at=0;at<=210;at++){
				if(AT[0]+at<=DF[1])continue;
				for(int df=0;df<=210;df++){
					int limit=INF;
					if(AT[1]>DF[0]+df){
						limit=(HP[0]+hp)/(AT[1]-(DF[0]+df));
						if((HP[0]+hp)%(AT[1]-(DF[0]+df))==0)limit--;
					}
					if(limit<=0)continue;
					int kill=HP[1]/(AT[0]+at-DF[1]);
					if(HP[1]%(AT[0]+at-DF[1])!=0)kill++;
					if(kill>0 limit>0 && kill<=limit){
						min=Math.Min(H*hp+A*at+D*df,min);
					}
				}
			}
		}

		Console.WriteLine(min);

	}
	int[] HP;
	int[] AT;
	int[] DF;
	int H;int A;int D;
	public Sol(){
		HP=new int[2];
		AT=new int[2];
		DF=new int[2];
		var d=ria();
		HP[0]=d[0];AT[0]=d[1];DF[0]=d[2];
		d=ria();
		HP[1]=d[0];AT[1]=d[1];DF[1]=d[2];
		d=ria();
		H=d[0];A=d[1];D=d[2];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}


using System;
using System.Collections.Generic;
using System.Text;

namespace Task_41C
{
    class Program
    {
        static void Main(string[] args)
        {
            /*
            string s = Console.ReadLine();
            int sLen = s.Length, atInd = -1;
            for (int i = 1; i < sLen - 3; i++)
                if (s[i] == 'a' && s[i + 1] == 't')
                {
                    atInd = i;
                    //s.Remove(atInd, 2);
                    //s.Insert(atInd, "@");
                    s = s.Replace("at", "@");
                    break;
                }

            Console.WriteLine(s);
            */
            /* 0123456
              "abcdatz"  7
                 i
               01234567
              "abatatzz"
                  i
               0123456
              "ab@atzz"
                     i
                01234567
               "abcdedot" 8
                  i
               012345678910
              "azzdotdotzz"

              0123456789
              "azz.dotzz"
             */
            StringBuilder builder = new StringBuilder(Console.ReadLine());
            for(int i = 1; i < builder.Length - 2; i++)
            {
                if (builder[i] == 'a' && builder[i + 1] == 't')
                    builder.Replace("at", "@", i, 2);
                else if (i != builder.Length - 3 && builder.ToString().Substring(i, 3).Equals("dot"))
                    builder.Replace("dot", ".", i, 3);
            }

            Console.WriteLine(builder.ToString());

        }
    }
}


using System;
using System.Text;
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            StringBuilder result = new StringBuilder();
            int doggy = input.IndexOf("at", 1), i = 1;
            result.Append(input[i]);
            Writer(result, ref i, doggy, input);
            result.Append('@');
            Writer(result, ref i, input.Length-1, input);
            result.Append(input[input.Length - 1]);
            Console.WriteLine(result.ToString());
        }
        private static void Writer(StringBuilder res, ref int strt, int end, string d)
        {
            for(int b; strt<end; )
            {
                b = d.IndexOf("dot", strt, end-strt);
                if (b < 0)
                   while(strt<end) res.Append(d[strt++]);

                else
                {
                    while (strt < b)
                        res.Append(d[strt++]);
                    res.Append('.');
                    strt = b + 3;
                }
            }
            strt = end + 2;
        }
    }


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _40_A
{
    class Program
    {
        static void Main(string[] args)
        {
            string inp = Console.ReadLine();
            string email = inp;
            int at = inp.LastIndexOf("at");
            if (at > 0)
            {
                email = email.Remove(at, 2);
                email = email.Insert(at, "@");
            }
            string domen = email.Substring(at + 1);
            int dotd = domen.LastIndexOf("dot");
            for (int i = 0; i < domen.Length; i++)
            {
                if (dotd < domen.Length)
                    domen = domen.Replace("dot", ".");
            }
            string user = email.Substring(0, at+1);
            for (int i = 0; i < user.Length; i++)
            {
                user = user.Replace("dot", ".");
            }
            email = user + domen;
            Console.WriteLine(email);
            Console.ReadLine();
        }
    }
}


using System;
class Program
{
	static void Main()
	{
		string st = Console.ReadLine();
		st = st.Replace("at", "@");
		st = st.Replace("dot", ".");

		for(int i = 0; i < st.Length; i++)
		{
			if((i == 0 || i == (st.Length - 1)) && st[i] == '.')
				Console.Write("dot");
			else if((i == 0 || i == (st.Length - 1)) && st[i] == '@')
				Console.Write("at");
			else
				Console.Write(st[i]);
		}
		Console.WriteLine();
	}
}


using System;
using System.Text;
namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var builder = new StringBuilder(Console.ReadLine());
            for(int i=1; i < builder.Length - 2; i++)
            {
                if (i <builder.Length - 3 && builder[i] == 'd' && builder[i + 1] == 'o' && builder[i + 2] == 't')
                    builder.Replace("dot", ".", i, 3);
                if (builder[i] == 'a' && builder[i + 1] == 't')
                    builder.Replace("at", "@", i, 2);
            }
            Console.WriteLine(builder);
        }
    }
}


using System;
using System.IO;
using System.Text;

namespace XOR_Equation
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            long s = Next();
            long x = Next();

            long delta = s - x;
            if (delta < 0 || delta%2 == 1 || (delta&x) !=0)
            {
                writer.WriteLine("0");
            }
            else
            {
                int count = SparseBitcount(x);
                long res = 1L << count;
                if (delta == 0)
                    res -= 2;
                writer.WriteLine(res);
            }

            writer.Flush();
        }

        private static int SparseBitcount(long n)
        {
            int count = 0;
            while (n != 0)
            {
                count++;
                n &= (n - 1);
            }
            return count;
        }

        private static long Next()
        {
            int c;
            long res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}