#define Online
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;
using System.Threading;

namespace CF
{
    delegate double F(double x);
    delegate decimal Fdec(decimal x);

    class Program
    {

        static void Main(string[] args)
        {

#if FileIO
            StreamReader sr = new StreamReader("input.txt");
            StreamWriter sw = new StreamWriter("output.txt");
            Console.SetIn(sr);
            Console.SetOut(sw);
#endif

            long n, m, x, y, a, b;
            string[] input = ReadArray();
            n = long.Parse(input[0]);
            m = long.Parse(input[1]);
            x = long.Parse(input[2]);
            y = long.Parse(input[3]);
            a = long.Parse(input[4]);
            b = long.Parse(input[5]);

            long gcd = MyMath.GCD(a, b);
            a /= gcd;
            b /= gcd;

            long left = 1;
            long right = m;

            long mid;
            while (left < right)
            {
                mid = left + ((right - left) >> 1);
                if (mid * a >= m || mid * b >= n)
                {
                    right = mid;
                }
                else
                {
                    left = mid + 1;
                }
            }
            if (!(left * a <= m && left * b <= n))
                left--;

            long w, h;
            w = left * a;
            h = left * b;
            long x1, y1, x2, y2;

            if (x - (w % 2 == 0 ? w / 2 : w / 2 + 1) >= 0)
            {
                if (x + w / 2 > m)
                {
                    x1 = x - (w % 2 == 0 ? w / 2 : w / 2 + 1);
                    x1 -= (x1 + w - m);
                    x2 = x1 + w;
                }
                else
                {
                    x1 = x - (w % 2 == 0 ? w / 2 : w / 2 + 1);
                    x2 = x1 + w;
                }
            }
            else
            {
                x1 = 0;
                x2 = w;
            }
            if (y - (h % 2 == 0 ? h / 2 : h / 2 + 1) >= 0)
            {
                if (y + h / 2 > n)
                {
                    y1 = y - (h % 2 == 0 ? h / 2 : h / 2 + 1);
                    y1 -= (y1 + h - n);
                    y2 = y1 + h;
                }
                else
                {
                    y1 = y - (h % 2 == 0 ? h / 2 : h / 2 + 1);
                    y2 = y1 + h;
                }
            }
            else
            {
                y1 = 0;
                y2 = h;
            }
            Console.WriteLine(x1 + " " + y1 + " " + x2 + " " + y2);
#if Online
            Console.ReadLine();
#endif

#if FileIO
            sr.Close();
            sw.Close();
#endif
        }

        static string[] ReadArray()
        {
            return Console.ReadLine().Split(' ');
        }

        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }
    }

    public static class MyMath
    {
        public static long BinPow(long a, long n, long mod)
        {
            long res = 1;
            while (n > 0)
            {
                if ((n & 1) == 1)
                {
                    res = (res * a) % mod;
                }
                a = (a * a) % mod;
                n >>= 1;
            }
            return res;
        }

        public static long GCD(long a, long b)
        {
            while (b != 0) b = a % (a = b);
            return a;
        }

        public static int GCD(int a, int b)
        {
            while (b != 0) b = a % (a = b);
            return a;
        }

        public static long LCM(long a, long b)
        {
            return (a * b) / GCD(a, b);
        }

        public static int LCM(int a, int b)
        {
            return (a * b) / GCD(a, b);
        }
    }

    public class SegmentTree
    {
        int[] v_min;
        int[] v_max;
        int[] mas;
        public void BuildTree(int[] a)
        {
            int n = a.Length - 1;
            int z = 0;
            while (n >= 2)
            {
                z++;
                n >>= 1;
            }
            n = 1 << (z + 1);
            v_min = new int[n << 1];
            v_max = new int[n << 1];
            mas = new int[n << 1];
            for (int i = n; i < n + a.Length; i++)
                v_min[i] = a[i - n];
            for (int i = n + a.Length; i < v_min.Length; i++)
                v_min[i] = int.MaxValue;
            for (int i = n - 1; i > 0; i--)
                v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);

            for (int i = n; i < n + a.Length; i++)
                v_max[i] = a[i - n];
            for (int i = n + a.Length; i < v_max.Length; i++)
                v_max[i] = int.MinValue;
            for (int i = n - 1; i > 0; i--)
                v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);

        }
        //nil
        public int RMQ_MIN(int l, int r)
        {
            int ans = int.MaxValue;
            l += v_min.Length >> 1;
            r += v_min.Length >> 1;
            const int o = 1;
            while (l <= r)
            {
                if ((l & 1) == o)
                    ans = Math.Min(ans, v_min[l]);
                if (!((r & 1) == 0))
                    ans = Math.Min(ans, v_min[r]);
                l = (l + 1) >> 1;
                r = (r - 1) >> 1;
            }
            return ans;
        }

        public int RMQ_MAX(int l, int r)
        {
            int ans = int.MinValue;
            l += v_max.Length >> 1;
            r += v_max.Length >> 1;
            const int o = 1;
            while (l <= r)
            {
                if ((l & 1) == o)
                    ans = Math.Max(ans, v_max[l]);
                if (!((r & 1) == 0))
                    ans = Math.Max(ans, v_max[r]);
                l = (l + 1) >> 1;
                r = (r - 1) >> 1;
            }
            return ans;
        }

        public void Put(int l, int r, int op)
        {
            l += mas.Length >> 1;
            r += mas.Length >> 1;
            while (l <= r)
            {
                if (l % 2 != 0)
                    mas[l] = op;
                if (r % 2 == 0)
                    mas[r] = op;
                l = (l + 1) >> 1;
                r = (r - 1) >> 1;
            }
        }

        public int Get(int x)
        {
            x += mas.Length >> 1;
            int ans = int.MinValue;
            while (x > 0)
            {
                ans = Math.Max(mas[x], ans);
                x >>= 1;
            }
            return ans;
        }

        public void Update(int i, int x)
        {
            i += v_min.Length >> 1;
            v_min[i] = x;
            v_max[i] = x;
            i >>= 1;
            while (i > 0)
            {
                v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);
                v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);
                i >>= 1;
            }
        }
    }
    class Edge
    {
        public int a;
        public int b;
        public int w;

        public Edge(int a, int b, int w)
        {
            this.a = a;
            this.b = b;
            this.w = w;
        }
    }
    class Graph
    {
        public List<List<int>> g = new List<List<int>>();
        public List<Edge> e = new List<Edge>();
        public Stack<int> s;
        public List<bool> u;
        public List<int> d; //длина
        public List<int> p; //путь
        public Queue<int> q;
        public int n;
        public int start;
        public int finish;
        public Graph(int n)
        {
            for (int i = 0; i <= n; i++)
                g.Add(new List<int>());
            p = new List<int>();
            d = new List<int>();
            for (int i = 0; i <= n; i++)
                p.Add(-1);
            for (int i = 0; i <= n; i++)
                d.Add(-1);
            u = new List<bool>();
            for (int i = 0; i <= n; i++)
                u.Add(true);
            this.n = n;
        }

        public bool dfs1(int v)
        {
            u[v] = false;
            for (int i = 0; i < g[v].Count; i++)
            {
                if (u[g[v][i]])
                {
                    p[g[v][i]] = v;
                    if (dfs1(g[v][i])) return true;
                }
                else
                {
                    if (p[v] != g[v][i])
                    {
                        start = v;
                        finish = g[v][i];
                        return true;
                    }
                }
            }
            return false;
        }

        public void dfs2(int v)
        {
            s = new Stack<int>();
            s.Push(v);
            int cur;
            bool all;
            while (s.Count != 0)
            {
                cur = s.Peek();
                all = true;
                for (int i = 0; i < g[cur].Count; i++)
                {
                    if (d[g[cur][i]] == -1)
                    {
                        s.Push(g[cur][i]);
                        d[g[cur][i]] = d[cur] + 1;
                        all = false;
                    }
                }
                if (all)
                    s.Pop();
            }
        }

        public void DFS(int v)
        {
            s = new Stack<int>();

            s.Push(v);
            int cur;
            bool all;
            while (s.Count != 0)
            {
                cur = s.Peek();
                u[cur] = false;
                all = true;
                for (int i = 0; i < g[cur].Count; i++)
                {
                    if (u[g[cur][i]])
                    {
                        all = false;
                        p[g[cur][i]] = cur;
                        s.Push(g[cur][i]);
                    }
                    else
                    {
                        if (p[cur] != g[cur][i])
                        {
                            start = cur;
                            finish = g[cur][i];
                            return;
                        }
                    }
                }
                if (all)
                    s.Pop();
            }
        }

        public void BFS(params int[] v)
        {
            q = new Queue<int>();
            u = new List<bool>();
            d = new List<int>();
            p = new List<int>();

            for (int i = 0; i <= n; i++)
            {
                u.Add(true);
                d.Add(0);
                p.Add(0);
            }

            q.Enqueue(v[0]);
            u[v[0]] = false;
            int cur;

            while (q.Count != 0)
            {
                cur = q.Dequeue();
                for (int i = 0; i < g[cur].Count; i++)
                    if (u[g[cur][i]])
                    {
                        q.Enqueue(g[cur][i]);
                        u[g[cur][i]] = false;
                        p[g[cur][i]] = cur;
                        d[g[cur][i]] = d[cur] + 1;
                    }
            }

            int from = v[1];
            string path = from + "";
            while (p[from] != 0)
            {
                path = p[from] + " " + path;
                from = p[from];
            }
            Console.WriteLine(d[v[1]] + " : " + path);
        }

        public void FordBellman(params int[] v)
        {
            d = new List<int>();
            p = new List<int>();
            for (int i = 0; i <= n; i++)
            {
                d.Add(int.MaxValue);
                p.Add(0);
            }
            d[v[0]] = 0;

            for (int i = 0; i < n - 1; i++)
            {
                for (int j = 0; j < e.Count; j++)
                {
                    if (d[e[j].a] != int.MaxValue)
                    {
                        if (d[e[j].a] + e[j].w < d[e[j].b])
                        {
                            d[e[j].b] = d[e[j].a] + e[j].w;
                            p[e[j].b] = e[j].a;
                        }
                    }
                }
            }

            int from = v[1];

            if (d[from] == int.MaxValue)
            {
                Console.WriteLine("Can't find the minimal path");
                return;
            }

            string ans = from + "";
            while (p[from] != 0)
            {
                ans = p[from] + " " + ans;
                from = p[from];
            }

            Console.WriteLine(d[v[1]] + " : " + ans);
        }
    }
    static class ArrayUtils
    {
        public static int BinarySearch(int[] a, int val)
        {
            int left = 0;
            int right = a.Length - 1;
            int mid;

            while (left < right)
            {
                mid = left + ((right - left) >> 1);
                if (val <= a[mid])
                {
                    right = mid;
                }
                else
                {
                    left = mid + 1;
                }
            }

            if (a[left] == val)
                return left;
            else
                return -1;
        }

        public static double Bisection(F f, double left, double right, double eps)
        {
            double mid;
            while (right - left > eps)
            {
                mid = left + ((right - left) / 2d);
                if (Math.Sign(f(mid)) != Math.Sign(f(left)))
                    right = mid;
                else
                    left = mid;
            }
            return (left + right) / 2d;
        }

        public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)
        {
            decimal m1, m2;
            while (r - l > eps)
            {
                m1 = l + (r - l) / 3m;
                m2 = r - (r - l) / 3m;
                if (f(m1) < f(m2))
                    if (isMax)
                        l = m1;
                    else
                        r = m2;
                else
                    if (isMax)
                        r = m2;
                    else
                        l = m1;
            }
            return r;
        }

        public static double TernarySearch(F f, double eps, double l, double r, bool isMax)
        {
            double m1, m2;
            while (r - l > eps)
            {
                m1 = l + (r - l) / 3d;
                m2 = r - (r - l) / 3d;
                if (f(m1) < f(m2))
                    if (isMax)
                        l = m1;
                    else
                        r = m2;
                else
                    if (isMax)
                        r = m2;
                    else
                        l = m1;
            }
            return r;
        }

        public static void Merge<T>(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable<T>
        {
            for (int i = p; i <= q; i++)
                L[i] = A[i];
            for (int i = q + 1; i <= r; i++)
                R[i] = A[i];

            for (int k = p, i = p, j = q + 1; k <= r; k++)
            {
                if (i > q)
                {
                    for (; k <= r; k++, j++)
                        A[k] = R[j];
                    return;
                }
                if (j > r)
                {
                    for (; k <= r; k++, i++)
                        A[k] = L[i];
                    return;
                }
                if (L[i].CompareTo(R[j]) <= 0)
                {
                    A[k] = L[i];
                    i++;
                }
                else
                {
                    A[k] = R[j];
                    j++;
                }
            }
        }

        public static void Merge_Sort<T>(T[] A, int p, int r, T[] L, T[] R) where T : IComparable<T>
        {
            if (p >= r) return;
            int q = p + ((r - p) >> 1);
            Merge_Sort(A, p, q, L, R);
            Merge_Sort(A, q + 1, r, L, R);
            Merge(A, p, q, r, L, R);
        }

        static void Shake<T>(T[] a)
        {
            Random rnd = new Random(Environment.TickCount);
            T temp;
            int b, c;
            for (int i = 0; i < a.Length; i++)
            {
                b = rnd.Next(0, a.Length);
                c = rnd.Next(0, a.Length);
                temp = a[b];
                a[b] = a[c];
                a[c] = temp;
            }
        }
    }
}


#define FileIO
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;
using System.Threading;

namespace CF
{
    delegate double F(double x);
    delegate decimal Fdec(decimal x);

    class Program
    {

        static void Main(string[] args)
        {

#if FileIO
            StreamReader sr = new StreamReader("input.txt");
            StreamWriter sw = new StreamWriter("output.txt");
            Console.SetIn(sr);
            Console.SetOut(sw);
#endif

            long n, m, x, y, a, b;
            string[] input = ReadArray();
            n = long.Parse(input[0]);
            m = long.Parse(input[1]);
            x = long.Parse(input[2]);
            y = long.Parse(input[3]);
            a = long.Parse(input[4]);
            b = long.Parse(input[5]);

            long gcd = MyMath.GCD(a, b);
            a /= gcd;
            b /= gcd;

            long left = 1;
            long right = m;

            long mid;
            while (left < right)
            {
                mid = left + ((right - left) >> 1);
                if (mid * a >= n || mid * b >= m)
                {
                    right = mid;
                }
                else
                {
                    left = mid + 1;
                }
            }
            if (!(left * a <= n && left * b <= m))
                left--;

            long w, h;
            w = left * a;
            h = left * b;
            long x1, y1, x2, y2;
            x1 = x2 = y1 = y2 = 0;

            if (x + w / 2 > n)
            {
                x1 = x - (w % 2L == 0 ? w / 2L : w / 2L + 1L) - (x + w / 2L - n);
                x2 = x1 + w;
            }
            else
            {
                if (x - (w % 2 == 0 ? w / 2 : w / 2 + 1) < 0)
                {
                    x1 = 0;
                    x2 = w;
                }
                else
                {
                    x1 = x - (w % 2L == 0 ? w / 2L : w / 2L + 1L);
                    x2 = x1 + w;
                }
            }
            if (y + h / 2 > m)
            {
                y1 = y - (h % 2L == 0 ? h / 2L : h / 2L + 1L) - (y + h / 2L - m);
                y2 = y1 + h;
            }
            else
            {
                if (y - (h % 2 == 0 ? h / 2 : h / 2 + 1) < 0)
                {
                    y1 = 0;
                    y2 = h;
                }
                else
                {
                    y1 = y - (h % 2L == 0 ? h / 2L : h / 2L + 1L);
                    y2 = y1 + h;
                }
            }

            Console.WriteLine(x1 + " " + y1 + " " + x2 + " " + y2);
#if Online
            Console.ReadLine();
#endif

#if FileIO
            sr.Close();
            sw.Close();
#endif
        }

        static string[] ReadArray()
        {
            return Console.ReadLine().Split(' ');
        }

        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }
    }

    public static class MyMath
    {
        public static long BinPow(long a, long n, long mod)
        {
            long res = 1;
            while (n > 0)
            {
                if ((n & 1) == 1)
                {
                    res = (res * a) % mod;
                }
                a = (a * a) % mod;
                n >>= 1;
            }
            return res;
        }

        public static long GCD(long a, long b)
        {
            while (b != 0) b = a % (a = b);
            return a;
        }

        public static int GCD(int a, int b)
        {
            while (b != 0) b = a % (a = b);
            return a;
        }

        public static long LCM(long a, long b)
        {
            return (a * b) / GCD(a, b);
        }

        public static int LCM(int a, int b)
        {
            return (a * b) / GCD(a, b);
        }
    }

    public class SegmentTree
    {
        int[] v_min;
        int[] v_max;
        int[] mas;
        public void BuildTree(int[] a)
        {
            int n = a.Length - 1;
            int z = 0;
            while (n >= 2)
            {
                z++;
                n >>= 1;
            }
            n = 1 << (z + 1);
            v_min = new int[n << 1];
            v_max = new int[n << 1];
            mas = new int[n << 1];
            for (int i = n; i < n + a.Length; i++)
                v_min[i] = a[i - n];
            for (int i = n + a.Length; i < v_min.Length; i++)
                v_min[i] = int.MaxValue;
            for (int i = n - 1; i > 0; i--)
                v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);

            for (int i = n; i < n + a.Length; i++)
                v_max[i] = a[i - n];
            for (int i = n + a.Length; i < v_max.Length; i++)
                v_max[i] = int.MinValue;
            for (int i = n - 1; i > 0; i--)
                v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);

        }
        //nil
        public int RMQ_MIN(int l, int r)
        {
            int ans = int.MaxValue;
            l += v_min.Length >> 1;
            r += v_min.Length >> 1;
            const int o = 1;
            while (l <= r)
            {
                if ((l & 1) == o)
                    ans = Math.Min(ans, v_min[l]);
                if (!((r & 1) == 0))
                    ans = Math.Min(ans, v_min[r]);
                l = (l + 1) >> 1;
                r = (r - 1) >> 1;
            }
            return ans;
        }

        public int RMQ_MAX(int l, int r)
        {
            int ans = int.MinValue;
            l += v_max.Length >> 1;
            r += v_max.Length >> 1;
            const int o = 1;
            while (l <= r)
            {
                if ((l & 1) == o)
                    ans = Math.Max(ans, v_max[l]);
                if (!((r & 1) == 0))
                    ans = Math.Max(ans, v_max[r]);
                l = (l + 1) >> 1;
                r = (r - 1) >> 1;
            }
            return ans;
        }

        public void Put(int l, int r, int op)
        {
            l += mas.Length >> 1;
            r += mas.Length >> 1;
            while (l <= r)
            {
                if (l % 2 != 0)
                    mas[l] = op;
                if (r % 2 == 0)
                    mas[r] = op;
                l = (l + 1) >> 1;
                r = (r - 1) >> 1;
            }
        }

        public int Get(int x)
        {
            x += mas.Length >> 1;
            int ans = int.MinValue;
            while (x > 0)
            {
                ans = Math.Max(mas[x], ans);
                x >>= 1;
            }
            return ans;
        }

        public void Update(int i, int x)
        {
            i += v_min.Length >> 1;
            v_min[i] = x;
            v_max[i] = x;
            i >>= 1;
            while (i > 0)
            {
                v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);
                v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);
                i >>= 1;
            }
        }
    }
    class Edge
    {
        public int a;
        public int b;
        public int w;

        public Edge(int a, int b, int w)
        {
            this.a = a;
            this.b = b;
            this.w = w;
        }
    }
    class Graph
    {
        public List<List<int>> g = new List<List<int>>();
        public List<Edge> e = new List<Edge>();
        public Stack<int> s;
        public List<bool> u;
        public List<int> d; //длина
        public List<int> p; //путь
        public Queue<int> q;
        public int n;
        public int start;
        public int finish;
        public Graph(int n)
        {
            for (int i = 0; i <= n; i++)
                g.Add(new List<int>());
            p = new List<int>();
            d = new List<int>();
            for (int i = 0; i <= n; i++)
                p.Add(-1);
            for (int i = 0; i <= n; i++)
                d.Add(-1);
            u = new List<bool>();
            for (int i = 0; i <= n; i++)
                u.Add(true);
            this.n = n;
        }

        public bool dfs1(int v)
        {
            u[v] = false;
            for (int i = 0; i < g[v].Count; i++)
            {
                if (u[g[v][i]])
                {
                    p[g[v][i]] = v;
                    if (dfs1(g[v][i])) return true;
                }
                else
                {
                    if (p[v] != g[v][i])
                    {
                        start = v;
                        finish = g[v][i];
                        return true;
                    }
                }
            }
            return false;
        }

        public void dfs2(int v)
        {
            s = new Stack<int>();
            s.Push(v);
            int cur;
            bool all;
            while (s.Count != 0)
            {
                cur = s.Peek();
                all = true;
                for (int i = 0; i < g[cur].Count; i++)
                {
                    if (d[g[cur][i]] == -1)
                    {
                        s.Push(g[cur][i]);
                        d[g[cur][i]] = d[cur] + 1;
                        all = false;
                    }
                }
                if (all)
                    s.Pop();
            }
        }

        public void DFS(int v)
        {
            s = new Stack<int>();

            s.Push(v);
            int cur;
            bool all;
            while (s.Count != 0)
            {
                cur = s.Peek();
                u[cur] = false;
                all = true;
                for (int i = 0; i < g[cur].Count; i++)
                {
                    if (u[g[cur][i]])
                    {
                        all = false;
                        p[g[cur][i]] = cur;
                        s.Push(g[cur][i]);
                    }
                    else
                    {
                        if (p[cur] != g[cur][i])
                        {
                            start = cur;
                            finish = g[cur][i];
                            return;
                        }
                    }
                }
                if (all)
                    s.Pop();
            }
        }

        public void BFS(params int[] v)
        {
            q = new Queue<int>();
            u = new List<bool>();
            d = new List<int>();
            p = new List<int>();

            for (int i = 0; i <= n; i++)
            {
                u.Add(true);
                d.Add(0);
                p.Add(0);
            }

            q.Enqueue(v[0]);
            u[v[0]] = false;
            int cur;

            while (q.Count != 0)
            {
                cur = q.Dequeue();
                for (int i = 0; i < g[cur].Count; i++)
                    if (u[g[cur][i]])
                    {
                        q.Enqueue(g[cur][i]);
                        u[g[cur][i]] = false;
                        p[g[cur][i]] = cur;
                        d[g[cur][i]] = d[cur] + 1;
                    }
            }

            int from = v[1];
            string path = from + "";
            while (p[from] != 0)
            {
                path = p[from] + " " + path;
                from = p[from];
            }
            Console.WriteLine(d[v[1]] + " : " + path);
        }

        public void FordBellman(params int[] v)
        {
            d = new List<int>();
            p = new List<int>();
            for (int i = 0; i <= n; i++)
            {
                d.Add(int.MaxValue);
                p.Add(0);
            }
            d[v[0]] = 0;

            for (int i = 0; i < n - 1; i++)
            {
                for (int j = 0; j < e.Count; j++)
                {
                    if (d[e[j].a] != int.MaxValue)
                    {
                        if (d[e[j].a] + e[j].w < d[e[j].b])
                        {
                            d[e[j].b] = d[e[j].a] + e[j].w;
                            p[e[j].b] = e[j].a;
                        }
                    }
                }
            }

            int from = v[1];

            if (d[from] == int.MaxValue)
            {
                Console.WriteLine("Can't find the minimal path");
                return;
            }

            string ans = from + "";
            while (p[from] != 0)
            {
                ans = p[from] + " " + ans;
                from = p[from];
            }

            Console.WriteLine(d[v[1]] + " : " + ans);
        }
    }
    static class ArrayUtils
    {
        public static int BinarySearch(int[] a, int val)
        {
            int left = 0;
            int right = a.Length - 1;
            int mid;

            while (left < right)
            {
                mid = left + ((right - left) >> 1);
                if (val <= a[mid])
                {
                    right = mid;
                }
                else
                {
                    left = mid + 1;
                }
            }

            if (a[left] == val)
                return left;
            else
                return -1;
        }

        public static double Bisection(F f, double left, double right, double eps)
        {
            double mid;
            while (right - left > eps)
            {
                mid = left + ((right - left) / 2d);
                if (Math.Sign(f(mid)) != Math.Sign(f(left)))
                    right = mid;
                else
                    left = mid;
            }
            return (left + right) / 2d;
        }

        public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)
        {
            decimal m1, m2;
            while (r - l > eps)
            {
                m1 = l + (r - l) / 3m;
                m2 = r - (r - l) / 3m;
                if (f(m1) < f(m2))
                    if (isMax)
                        l = m1;
                    else
                        r = m2;
                else
                    if (isMax)
                        r = m2;
                    else
                        l = m1;
            }
            return r;
        }

        public static double TernarySearch(F f, double eps, double l, double r, bool isMax)
        {
            double m1, m2;
            while (r - l > eps)
            {
                m1 = l + (r - l) / 3d;
                m2 = r - (r - l) / 3d;
                if (f(m1) < f(m2))
                    if (isMax)
                        l = m1;
                    else
                        r = m2;
                else
                    if (isMax)
                        r = m2;
                    else
                        l = m1;
            }
            return r;
        }

        public static void Merge<T>(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable<T>
        {
            for (int i = p; i <= q; i++)
                L[i] = A[i];
            for (int i = q + 1; i <= r; i++)
                R[i] = A[i];

            for (int k = p, i = p, j = q + 1; k <= r; k++)
            {
                if (i > q)
                {
                    for (; k <= r; k++, j++)
                        A[k] = R[j];
                    return;
                }
                if (j > r)
                {
                    for (; k <= r; k++, i++)
                        A[k] = L[i];
                    return;
                }
                if (L[i].CompareTo(R[j]) <= 0)
                {
                    A[k] = L[i];
                    i++;
                }
                else
                {
                    A[k] = R[j];
                    j++;
                }
            }
        }

        public static void Merge_Sort<T>(T[] A, int p, int r, T[] L, T[] R) where T : IComparable<T>
        {
            if (p >= r) return;
            int q = p + ((r - p) >> 1);
            Merge_Sort(A, p, q, L, R);
            Merge_Sort(A, q + 1, r, L, R);
            Merge(A, p, q, r, L, R);
        }

        static void Shake<T>(T[] a)
        {
            Random rnd = new Random(Environment.TickCount);
            T temp;
            int b, c;
            for (int i = 0; i < a.Length; i++)
            {
                b = rnd.Next(0, a.Length);
                c = rnd.Next(0, a.Length);
                temp = a[b];
                a[b] = a[c];
                a[c] = temp;
            }
        }
    }
}


public static int[] RemoveDuplicates(int size, int[] inputArr)
        {
            Dictionary<int,int> dict = new Dictionary<int,int>();
            HashSet<int> hsh = new HashSet<int>();
            List<int> outputList = new List<int>();
            for(int i=0;i<size;i++)
            {
                int currNum = inputArr[i];
                if(dict.ContainsKey(currNum))
                {
                    int prevPos = dict[currNum];
                    hsh.Add(prevPos);
                }
                dict[currNum] = i;
            }
            for(int i=0;i<size;i++)
            {
                if(!hsh.Contains(i))
                    outputList.Add(inputArr[i]);
            }
            return outputList.ToArray();
        }


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

namespace Тамик
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int[] mas = new int[n];
            string[] s = Console.ReadLine().Split(' ');
            for (int i = 0; i < n; i++)
            {
                mas[i] = Convert.ToInt32(s[i]);
            }
            int y = 1;
            Array.Sort(mas);
            for (int i = 0; i < n - 1; i++)
            {
                if (mas[i] != mas[i + 1])
                {
                    y++;
                }
            }
            int w = 0;
            int[] mas1 = new int[y];
            string[] c = Console.ReadLine().Split(' ');
            for (int i = n - 1; i > 0; i -= 1)
            {
                if (mas[i] != mas[i - 1] )
                {
                    mas1[w] = mas[i];
                    w++;
                    mas1[w] = mas[i - 1];
                }
                if (y == 1)
                    mas1[0] = mas[i];
            }
            Console.WriteLine(y);
            for (int i = 0; i < y; i++)
            {
                Console.Write(mas1[i] + " ");
            }

        }
    }
}


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

//namespace Practice
//{
    public class Program
    {
        public static void Main()
        {
            A978();
            //Console.ReadKey();
        }

        public static void A978()
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = new int[n];
            Boolean[] seen = new Boolean[1001];
            Stack<int> stack = new Stack<int>();

            String[] num = Console.ReadLine().Split();
            for(int i = n-1; i>=0 ; i--)
            {
                int x = int.Parse(num[i]);
                if(!seen[x])
                {
                    stack.Push(x);
                    seen[x] = true;
                }
            }

            StringBuilder output = new StringBuilder();
            output.Append(stack.Count + "\n");

            while (stack.Count != 0)
            {
                output.Append(stack.Pop() + " ");
            }

            Console.WriteLine(output.ToString());

        }
    }

//}


using System;
using System.Linq;

namespace CodeForces862A
{
    public static void Main(string[] args)
    {
        var firstLine = "5 0";
        var secondLine = "1 2 3 4 5";

        var splitFirstLine = firstLine.Split(' ');
        var splitSecondLine = secondLine.Split(' ');

        var n = splitFirstLine[0];
        var x = int.Parse(splitFirstLine[1]);

        var listOfNumbers = splitSecondLine.Select(i => int.Parse(i)).ToList();

        var numberOfChanges = 0;

        while (x > 0)
        {
            if (!listOfNumbers.Contains(x - 1))
            {
                listOfNumbers.Add(x - 1);
                numberOfChanges++;
            }
            x--;
        }

        if (listOfNumbers.Contains(x))
        {
            listOfNumbers.Remove(x);
            numberOfChanges++;
        }

        Console.WriteLine(numberOfChanges);
    }
}


            var countAndEvil = Console.ReadLine();
            var mex = int.Parse(countAndEvil.Split(' ')[1]);

            var numbers = Console.ReadLine().
                Split(' ').
                Select(x => int.Parse(x)).
                ToList();

            int lessCount = 0;
            int shouldBeDelete = 0;
            numbers.ForEach(x =>
            {
                if (x < mex) lessCount++;
                if (x == mex) shouldBeDelete++;
            });

            var k = mex - lessCount + shouldBeDelete;

            Console.WriteLine(Math.Min(k, numbers.Count));


<?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>{C845BAA9-539D-4B68-AE7F-F777A4F5311A}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <RootNamespace>D_CS</RootNamespace>
    <AssemblyName>D_CS</AssemblyName>
    <TargetFrameworkVersion>v4.5.2</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.Collections;
using System.Linq;
using System.Numerics;

namespace contest
{

    class contest
    {

        static void Main(string[] args)
        {

            //int n = int.Parse(Console.ReadLine());
            //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();

            long n = long.Parse(Console.ReadLine());

            long count = 0;

            while(n>1)
            {
                for(long i = n; i>1; i--)
                {
                    if(IsPrime(i) && n-i!=1)
                    {
                        count++;
                        n -= i;
                        break;
                    }

                    if(i==2)
                    {
                        count += n / 2;
                        n /= 2;
                    }
                }
            }

            Console.WriteLine(count);

            //Console.WriteLine(ans.ToString(System.Globalization.CultureInfo.InvariantCulture));

        }

        public static bool IsPrime(long a)
        {
            for(long i = a-1; i>1; i--)
            {
                if (a % i == 0) return false;
            }

            return true;
        }

    }

}


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

	class contest
	{

		static void Main(string[] args)
		{

			 var num = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            Array.Sort(num);
            int mxTable = num.Min();

            var cp = new List<int>(num);
            int min = num.Min();
            for (int i =0; i<3; i++)
            {
                cp[i] -= min;
            }

            while(cp[1]>=1 && cp[2]>=2)
            {
                if (cp[1] >= 1 && cp[2] >= 2)
                {
                    mxTable++;
                    cp[1] -= 1;
                    cp[2] -= 2;
                }

            }

            cp = num.ToList();

            if (cp[0]>0 || cp[1]>0)
            {
                int tmp = 0;

                while (cp[0] >= 1 && cp[2] >= 2)
                {

                        tmp++;
                        cp[0] -= 1;
                        cp[2] -= 2;

                        cp.Sort();

                }

                while (cp[1] >= 1 && cp[2] >= 2)
                {

                    tmp++;
                    cp[1] -= 1;
                    cp[2] -= 2;

                    cp.Sort();

                }

                mxTable = Math.Max(mxTable,tmp);
            }

            Console.WriteLine(mxTable);

        }

	}


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

namespace Task2
{
    class Program
    {
        static void Main(string[] args)
        {
            //вводим n k и d
            string input = Console.ReadLine();
            string[] inputArr = input.Split();

            int n = Convert.ToInt32(inputArr[0]);
            int k = Convert.ToInt32(inputArr[1]);
            int d = Convert.ToInt32(inputArr[2]);

            int[] days = new int[n];

            //заполняем массив дней показа
            string inputDays = Console.ReadLine();
            string[] inputArrDays = inputDays.Split();
            for (int i = 0; i < days.Length; i++)
            {
                days[i] = Convert.ToInt32(inputArrDays[i]);
            }

            //массив "разных" сериалов
            int[] differentSerials = new int[k];
            for (int i = 0; i < differentSerials.Length; i++)
            {
                differentSerials[i] = 0;
            }

            //массив для "блоков" дней
            int[] arrForDaysBlock = new int[n - d + 1];
            for (int x = 0; x < arrForDaysBlock.Length; x++)
            {
                //проверяем, что в i день идет j сериал
                //если да, то в массив сериалов суем ++
                for (int i = x; i < x + d; i++)
                {
                    for (int j = 1; j < differentSerials.Length + 1; j++)
                    {
                        if (days[i] == j)
                        {
                            differentSerials[j - 1]++;
                        }
                    }
                }
                //подсчитываем сколько РАЗЛИЧНЫХ сериалов прошло в d дней
                //и записываем это в массив блоков дней
                int summ = 0;
                for (int i = 0; i < differentSerials.Length; i++)
                {
                    if (differentSerials[i] != 0)
                    {
                        summ++;
                    }
                }
                arrForDaysBlock[x] = summ;
                for (int i = 0; i < differentSerials.Length; i++)
                {
                    differentSerials[i] = 0;
                }
            }

            int min = arrForDaysBlock[0];
            for (int i = 0; i < arrForDaysBlock.Length; i++)
            {
                if (arrForDaysBlock[i] < min)
                {
                    min = arrForDaysBlock[i];
                }
            }

            Console.WriteLine(min);
        }
    }
}


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

namespace Olympiads
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = Convert.ToInt32(Console.ReadLine());
            int[] ret = new int[t];
            for (int i = 0; i < t; i++)
            {
                string t2 = Console.ReadLine();
                string[] temp1 = t2.Split(' ');
                int n = Convert.ToInt32(temp1[0]), k = Convert.ToInt32(temp1[1]), d = Convert.ToInt32(temp1[1]);
                string inp = Console.ReadLine();
                string[] temp2 = inp.Split(' ');
                int[] srav = new int[d];
                int y = 0,z = 0;
                for (int j = 0; j < d; j++)
                {
                    srav[j] = Convert.ToInt32(temp2[j]);
                }
                y = Test(srav, k);
                for (int j = d; j < n; j++)
                {
                    if (z > d-1)
                    {
                        z = 0;
                    }
                    srav[z] = Convert.ToInt32(temp2[j]);
                    z++;
                    if (y > Test(srav,k))
                    {
                        y = Test(srav, k);
                    }
                }
                ret[i] = y;
            }
            for (int i = 0; i < t; i++)
            {
                Console.WriteLine(ret[i]);
            }

        }
        static int Test(int[] testing, int k)
        {
            int ret = 0;
            int[] a = new int[k];
            for (int i = 0; i < testing.Length; i++)
            {
                a[testing[i]-1]++;
            }
            for (int i = 0; i < a.Length; i++)
            {
                if (a[i]>0)
                {
                    ret++;
                }
            }
            return ret;
        }
    }
}


using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows;

namespace ConsoleApplicationCSharp {
	class Program {
		static void Main(string[] args) {
			string filepath = @"C:\Users\Administrator\Documents\Visual Studio 2012\Projects\AAL4\AAL4\Resources\list.txt";
			string[] split = null;

			using (StreamReader sr = new StreamReader(filepath)) {
				split = sr.ReadToEnd().Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
			}

			string[] split2, name, actor;

			foreach (string str in split) {
				split2 = str.Split(',');

				name = split2[1].Split(' ');
				actor = split2[2].Split(' ');

				if (name[name.Length - 1] == actor[actor.Length - 1]) {
					Console.WriteLine("{0}, {1} : {2}", split2[2], split2[1], split2[0]);
				}
			}
		}
	}
}


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

namespace codeforce11
{
    class Program
    {

        static string Decrypt(string str, int t)
        {

                int[] arr = new int[t];
                int counter = 0;
                for (int i = 2; i <= t; i++)
                {
                    if (t % i == 0)
                    {
                        arr[counter++] = i;

                    }
                }
                string a = "";
                int count = counter;
                counter = 0;

                while (count > 0)
                {
                    a = str.Substring(0, arr[counter++]);
                    char[] array = a.ToCharArray();
                    Array.Reverse(array);
                    string st = "";
                    for (int i = 0; i < array.Length; i++)
                    {

                        st += array[i];
                    }

                    str = str.Replace(a, st);
                    count--;
                }

                return str;

        }
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            string str = Console.ReadLine();
            Console.WriteLine(Decrypt(str, t));
            Console.ReadLine();
        }
    }
}


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

namespace codeforce11
{
    class Program
    {

        static string Decrypt(string str, int t)
        {

            int[] arr = new int[t];
            int counter = 0;
            for (int i = 2; i <= t; i++)
            {
                if (t % i == 0 )
                {
                    arr[counter++] = i;

                }
            }
            for (int i = 0; i < arr.Length; i++)
            {
                Console.WriteLine(arr[i]);
            }
            string a = "";
            int count = counter;
            counter = 0;

            while (count != 0)
            {

                a = str.Substring(0, arr[counter]);
                //Console.WriteLine(a);

                string st = a.Reverse().Aggregate(string.Empty, (acc, ch) => acc + ch);
                //Console.WriteLine(st);
                var aStringBuilder = new StringBuilder(str);
                aStringBuilder.Remove(0, arr[counter]);
                aStringBuilder.Insert(0, st);
                str = aStringBuilder.ToString();
                //Console.WriteLine(str);
                count--;
                counter++;
            } ;
            return str;
        }
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            string str = Console.ReadLine();
            Console.WriteLine(Decrypt(str, t));

        }
    }
}


using System;

namespace std
{
    class Program
    {
        static void Main()
        {
            int NumberCount = 0,NumberInt = 0;
            NumberCount = int.Parse(Console.ReadLine());
            NumberInt = int.Parse(Console.ReadLine());
            string NumberString = NumberInt.ToString();
            int[] Array;
            Array = new int[NumberCount];
            Boolean S1 = true,S2 = true;
            int i;
            for(i = 0;i<NumberCount;i++)
            {
                Array[i] = int.Parse(NumberString.Substring(i,1));
                if(Array[i] != 4 && Array[i] != 7)
                {
                    S1 = false;
                    break;
                }
            }
            if(S1 == false)
            {
                Console.WriteLine("NO");
            }
            else
            {
                int Sum1 = 0 ,Sum2 = 0;
                for(i = 0;i < (NumberCount / 2);i++)
                {
                    Sum1 += Array[i];
                }
                for(i = (NumberCount / 2);i < NumberCount;i++)
                {
                    Sum2 += Array[i];
                }
                if (Sum1 == Sum2)
                {
                    Console.WriteLine("YES");
                }
                else
                {
                    Console.WriteLine("NO");
                }
            }
        }
    }
}


//#define __debug

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

namespace _TestData
{
    public static class TestExtensions
    {
        public static string ToStr(this IEnumerable<string> ms)
        {
            return ms.Aggregate("", (current, s) => current + (s + ","));
        }

        public static decimal ConvertMinuteToMunite(int minute, int second = 0)
        {
            return minute + (decimal)second / 6 / 10;
        }
        public static decimal ConvertHourToMunite(int hour, int minute = 0, int second = 0)
        {
            //12.00-12.11 = 0
            //12.12-12.23 = 1
            //12.24-12.35 = 2
            //12.36-12.47 = 3
            //12.48-12.59 = 4

            int hInM = 5 * hour;
            if (hInM == 60) hInM = 0;
            return hInM + ((decimal) ConvertMinuteToMunite(minute, second) / 12) + ((decimal) second / 6 / 10);
            //return hInM;
        }
    }
    class Program
    {
        static void Main(string[] args)
        {

#if __debug
            var str = "6 59 59 11 12";
#else
            var str = Console.ReadLine();
#endif

            var h = Convert.ToInt32(str.Split(' ')[0]);
            var m = Convert.ToInt32(str.Split(' ')[1]);
            var s = Convert.ToInt32(str.Split(' ')[2]);

            var t1 = Convert.ToInt32(str.Split(' ')[3]);
            var t2 = Convert.ToInt32(str.Split(' ')[4]);

            Console.WriteLine(Check(TestExtensions.ConvertHourToMunite(h, m, s), TestExtensions.ConvertMinuteToMunite(m,s), s, TestExtensions.ConvertHourToMunite(t1), TestExtensions.ConvertHourToMunite(t2)));
        }

        static string Check(decimal hm, decimal mm, decimal sm, decimal t1, decimal t2)
        {
#if __debug
            Console.WriteLine($"hm={hm} mm={mm} sm={sm} t1={t1} t2={t2}");
#else

#endif
            //теперь у меня есть шкала 0-60 двунаправленная

            //надо глянуть преграды в 2 стороны между т1 и т2

            //пойдем всегда от меньшего к большему, так проще
            var tmin = t1 > t2 ? t2 : t1;
            var tmax = t1 > t2 ? t1 : t2;

            //пробуем пойти вперед от tmin до tmax ища пустой промежуток
            //if ((tmin >= hm || tmax <= hm) && (tmin >= mm || tmax <= mm) && (tmin >= sm || tmax <= sm))
            if ((tmin > hm || tmax < hm) && (tmin > mm || tmax < mm) && (tmin > sm || tmax < sm))
            {
#if __debug
                Console.WriteLine($"Нет преград по возрастанию");
#endif
                return "YES";
            }
            //пробуем пойти назад от tmin до 0 и вперед от tmax до 60 ища пустой промежуток
            //if (tmin == 0 || (tmin <= hm && tmin <= mm && tmin <=sm))
            if (tmin == 0 || (tmin < hm && tmin < mm && tmin < sm))
            {
#if __debug
                Console.WriteLine($"Нет преград по убыванию до 0 для tmin");
#endif
                //if (tmax == 60 || (tmax >= hm && tmax >= mm && tmax >= sm))
                if (tmax == 60 || (tmax > hm && tmax > mm && tmax > sm))
                {
#if __debug
                    Console.WriteLine($"Нет преград по возрастанию до 60 для tmax");
#endif
                    return "YES";
                }
            }

            if ((tmin >= hm || tmax <= hm) && (tmin >= mm || tmax <= mm) && (tmin >= sm || tmax <= sm))
            {
#if __debug
                Console.WriteLine($"Нет преград по возрастанию");
#endif
                return "YES";
            }

            return "NO";
        }
    }
}


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

using E = System.Linq.Enumerable;
using System.Threading;

internal partial class Solver {

    public static bool UpdateMin<T>(ref T x, T newValue) where T : IComparable<T> {
        if (x.CompareTo(newValue) > 0) { x = newValue; return true; }
        return false;
    }
    public static bool UpdateMax<T>(ref T x, T newValue) where T : IComparable<T> {
        if (x.CompareTo(newValue) < 0) { x = newValue; return true; }
        return false;
    }

    public void Run() {
        var n = ni();
        var k = ni();
        var s = ns();
        var t = ns();
        long ans = 0;
        if (t[0] == t[1]) {
            long count = s.Count(c => c == t[0]);
            count += k;
            if (count > s.Length) count = s.Length;
            ans = count * (count - 1) / 2;
        } else {
            var c1 = t[0];
            var c2 = t[1];
            var memo = new long?[s.Length, k + 1, n + 1]; // (changeNum, occurrence of c1)

            Func<int, int, int, long> dfs = null;

            dfs = (int pos, int changeNum, int c1Num) => {
                if (pos == s.Length) return 0;
                ref var ret = ref memo[pos, changeNum, c1Num];
                if (!ret.HasValue) {
                    long val = 0;
                    var c = s[pos];
                    if (c == c1) {
                        val = Math.Max(val, dfs(pos + 1, changeNum, c1Num + 1));
                    } else {
                        val = Math.Max(val, dfs(pos + 1, changeNum, c1Num));
                        if (changeNum < k) {
                            val = Math.Max(val, dfs(pos + 1, changeNum + 1, c1Num + 1));
                        }
                    }
                    if (c == c2) {
                        val = Math.Max(val, dfs(pos + 1, changeNum, c1Num) + c1Num);
                    } else {
                        if (changeNum < k) {
                            val = Math.Max(val, dfs(pos + 1, changeNum + 1, c1Num) + c1Num);
                        }
                    }
                    ret = val;
                }
                return ret.Value;
            }
            ans = dfs(0, 0, 0);
        }
        cout.WriteLine(ans);
    }

    public static void Fill<T>(T[,] array, T value) {
        int height = array.GetLength(0);
        int width = array.GetLength(1);
        for (int i = 0; i < height; i++) {
            for (int j = 0; j < width; j++) {
                array[i, j] = value;
            }
        }
    }

}

// PREWRITEN CODE BEGINS FROM HERE

static public class StringExtensions {
    static public string JoinToString<T>(this IEnumerable<T> source, string separator = " ") {
        return string.Join(separator, source);
    }
}

internal partial class Solver : Scanner {
    static readonly int? StackSizeInMebiByte = null; //50;
    public static void StartAndJoin(Action action, int maxStackSize) {
        var thread = new Thread(new ThreadStart(action), maxStackSize);
        thread.Start();
        thread.Join();
    }

    public static void Main() {
#if LOCAL
        byte[] inputBuffer = new byte[1000000];
        var inputStream = Console.OpenStandardInput(inputBuffer.Length);
        using (var reader = new StreamReader(inputStream, Console.InputEncoding, false, inputBuffer.Length)) {
            Console.SetIn(reader);
            new Solver(Console.In, Console.Out).Run();
        }
#else
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        if (StackSizeInMebiByte.HasValue) {
            StartAndJoin(() => new Solver(Console.In, Console.Out).Run(), StackSizeInMebiByte.Value * 1024 * 1024);
        } else {
            new Solver(Console.In, Console.Out).Run();
        }
        Console.Out.Flush();
#endif
    }

#pragma warning disable IDE0052
    private readonly TextReader cin;
    private readonly TextWriter cout;
    private readonly TextWriter cerr;
#pragma warning restore IDE0052

    public Solver(TextReader reader, TextWriter writer)
        : base(reader) {
        cin = reader;
        cout = writer;
        cerr = Console.Error;
    }

    public Solver(string input, TextWriter writer)
        : this(new StringReader(input), writer) {
    }

#pragma warning disable IDE1006
#pragma warning disable IDE0051
    private int ni() { return NextInt(); }
    private int[] ni(int n) { return NextIntArray(n); }
    private long nl() { return NextLong(); }
    private long[] nl(int n) { return NextLongArray(n); }
    private double nd() { return NextDouble(); }
    private double[] nd(int n) { return NextDoubleArray(n); }
    private string ns() { return Next(); }
    private string[] ns(int n) { return NextArray(n); }
#pragma warning restore IDE1006
#pragma warning restore IDE0051
}

#if DEBUG
internal static class LinqPadExtension {
    public static string TextDump<T>(this T obj) {
        if (obj is IEnumerable) return (obj as IEnumerable).Cast<object>().JoinToString().Dump();
        else return obj.ToString().Dump();
    }
    public static T Dump<T>(this T obj) {
        return LINQPad.Extensions.Dump(obj);
    }
}
#endif

public class Scanner {
    private readonly TextReader Reader;
    private readonly CultureInfo ci = CultureInfo.InvariantCulture;

    private readonly char[] buffer = new char[2 * 1024];
    private int cursor = 0, length = 0;
    private string Token;
    private readonly StringBuilder sb = new StringBuilder(1024);

    public Scanner()
        : this(Console.In) {
    }

    public Scanner(TextReader reader) {
        Reader = reader;
    }

    public int NextInt() { return checked((int)NextLong()); }
    public long NextLong() {
        var s = Next();
        long r = 0;
        int i = 0;
        bool negative = false;
        if (s[i] == '-') {
            negative = true;
            i++;
        }
        for (; i < s.Length; i++) {
            r = r * 10 + (s[i] - '0');
#if DEBUG
            if (!char.IsDigit(s[i])) throw new FormatException();
#endif
        }
        return negative ? -r : r;
    }
    public double NextDouble() { return double.Parse(Next(), ci); }
    public string[] NextArray(int size) {
        string[] array = new string[size];
        for (int i = 0; i < size; i++) {
            array[i] = Next();
        }

        return array;
    }
    public int[] NextIntArray(int size) {
        int[] array = new int[size];
        for (int i = 0; i < size; i++) {
            array[i] = NextInt();
        }

        return array;
    }

    public long[] NextLongArray(int size) {
        long[] array = new long[size];
        for (int i = 0; i < size; i++) {
            array[i] = NextLong();
        }

        return array;
    }

    public double[] NextDoubleArray(int size) {
        double[] array = new double[size];
        for (int i = 0; i < size; i++) {
            array[i] = NextDouble();
        }

        return array;
    }

    public string Next() {
        if (Token == null) {
            if (!StockToken()) {
                throw new Exception();
            }
        }
        var token = Token;
        Token = null;
        return token;
    }

    public bool HasNext() {
        if (Token != null) {
            return true;
        }

        return StockToken();
    }

    private bool StockToken() {
        while (true) {
            sb.Clear();
            while (true) {
                if (cursor >= length) {
                    cursor = 0;
                    if ((length = Reader.Read(buffer, 0, buffer.Length)) <= 0) {
                        break;
                    }
                }
                var c = buffer[cursor++];
                if (33 <= c && c <= 126) {
                    sb.Append(c);
                } else {
                    if (sb.Length > 0) break;
                }
            }

            if (sb.Length > 0) {
                Token = sb.ToString();
                return true;
            }

            return false;
        }
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static System.Math;
using System.Text;
using System.Threading;
using System.Globalization;
using System.Runtime.CompilerServices;
using Library;

namespace Program
{
    public static class ProblemF
    {
        static bool SAIKI = false;
        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 k = NN;
            var s = NS;
            var t = NS;
            var dp = new long[n + 1, n + 1, k + 1];
            for (var i = 0; i <= n; i++)
            {
                for (var j = 0; j <= n; j++)
                {
                    for (var x = 0; x <= k; x++)
                    {
                        dp[i, j, x] = long.MinValue;
                    }
                }
            }
            dp[0, 0, 0] = 0;
            var ans = 0L;
            for (var i = 0; i < n; i++)
            {
                for (var j = 0; j <= n; j++)
                {
                    for (var x = 0; x <= k; x++)
                    {
                        if (s[i] == t[0])
                        {
                            if (j < n) dp[i + 1, j + 1, x] = Max(dp[i + 1, j + 1, x], dp[i, j, x]);
                            if (x < k) dp[i + 1, j, x + 1] = Max(dp[i + 1, j, x + 1], dp[i, j, x] + j);
                        }
                        if (s[i] == t[1])
                        {
                            dp[i + 1, j, x] = Max(dp[i + 1, j, x], dp[i, j, x] + j);
                            if (x < k && j < n) dp[i + 1, j + 1, x + 1] = Max(dp[i + 1, j + 1, x + 1], dp[i, j, x]);
                        }
                        if (s[i] == t[0] && s[i] == t[1])
                        {
                            if (j < n) dp[i + 1, j + 1, x] = Max(dp[i + 1, j + 1, x], dp[i, j, x] + j);
                        }
                        if (t[0] == t[1])
                        {
                            if (x < k && j < n) dp[i + 1, j + 1, x + 1] = Max(dp[i + 1, j + 1, x + 1], dp[i, j, x] + j);
                        }
                        {
                            if (x < k) dp[i + 1, j, x + 1] = Max(dp[i + 1, j, x + 1], dp[i, j, x] + j);
                            if (x < k && j < n) dp[i + 1, j + 1, x + 1] = Max(dp[i + 1, j + 1, x + 1], dp[i, j, x]);
                            dp[i + 1, j, k] = Max(dp[i + 1, j, k], dp[i, j, k]);
                        }
                    }
                }
            }
            for (var i = 0; i <= n; i++)
            {
                for (var j = 0; j <= n; j++)
                {
                    for (var x = 0; x <= k; x++)
                    {
                        ans = Max(ans, dp[i, j, x]);
                    }
                }
            }
            Console.WriteLine(ans);
        }
        class Printer : StreamWriter
        {
            public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
            public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }
            public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }
        }
        static LIB_FastIO fastio = new LIB_FastIODebug();
        static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }
        static long NN => fastio.Long();
        static double ND => fastio.Double();
        static string NS => fastio.Scan();
        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 long Count<T>(this IEnumerable<T> x, Func<T, bool> pred) => Enumerable.Count(x, pred);
        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 IOrderedEnumerable<T> OrderByRand<T>(this IEnumerable<T> x) => Enumerable.OrderBy(x, _ => xorshift);
        static IOrderedEnumerable<T> OrderBy<T>(this IEnumerable<T> x) => Enumerable.OrderBy(x.OrderByRand(), e => e);
        static IOrderedEnumerable<T1> OrderBy<T1, T2>(this IEnumerable<T1> x, Func<T1, T2> selector) => Enumerable.OrderBy(x.OrderByRand(), selector);
        static IOrderedEnumerable<T> OrderByDescending<T>(this IEnumerable<T> x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);
        static IOrderedEnumerable<T1> OrderByDescending<T1, T2>(this IEnumerable<T1> x, Func<T1, T2> selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);
        static IOrderedEnumerable<string> OrderBy(this IEnumerable<string> x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);
        static IOrderedEnumerable<T> OrderBy<T>(this IEnumerable<T> x, Func<T, string> selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);
        static IOrderedEnumerable<string> OrderByDescending(this IEnumerable<string> x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);
        static IOrderedEnumerable<T> OrderByDescending<T>(this IEnumerable<T> x, Func<T, string> selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);
        static string Join<T>(this IEnumerable<T> x, string separator = "") => string.Join(separator, x);
        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; } }
    }
}
namespace Library {
    class LIB_FastIO
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public LIB_FastIO() { str = Console.OpenStandardInput(); }
        readonly Stream str;
        readonly byte[] buf = new byte[1024];
        int len, ptr;
        public bool isEof = false;
        public bool IsEndOfStream
        {
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            get { return isEof; }
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        byte read()
        {
            if (isEof) throw new EndOfStreamException();
            if (ptr >= len)
            {
                ptr = 0;
                if ((len = str.Read(buf, 0, 1024)) <= 0)
                {
                    isEof = true;
                    return 0;
                }
            }
            return buf[ptr++];
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        char Char()
        {
            byte b = 0;
            do b = read();
            while (b < 33 || 126 < b);
            return (char)b;
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        virtual public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
                sb.Append(b);
            return sb.ToString();
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        virtual public long Long()
        {
            long ret = 0; byte b = 0; var ng = false;
            do b = read();
            while (b != '-' && (b < '0' || '9' < b));
            if (b == '-') { ng = true; b = read(); }
            for (; true; b = read())
            {
                if (b < '0' || '9' < b)
                    return ng ? -ret : ret;
                else ret = ret * 10 + b - '0';
            }
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }
    }
    class LIB_FastIODebug : LIB_FastIO
    {
        Queue<string> param = new Queue<string>();
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public LIB_FastIODebug() { }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public override string Scan() => NextString();
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public override long Long() => long.Parse(NextString());
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public override double Double() => double.Parse(NextString());
    }
}


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

namespace ContestA
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] pass1 = Console.ReadLine().Split(' ');
            string[] pass2 = Console.ReadLine().Split(' ');
            string[] pass3 = Console.ReadLine().Split(' ');
            string[] pass4 = Console.ReadLine().Split(' ');

            int a1 = Convert.ToInt32(pass1[0]);
            int b1 = Convert.ToInt32(pass1[1]);
            int a2 = Convert.ToInt32(pass2[0]);
            int b2 = Convert.ToInt32(pass2[1]);
            int a3 = Convert.ToInt32(pass3[0]);
            int b3 = Convert.ToInt32(pass3[1]);
            int a4 = Convert.ToInt32(pass4[0]);
            int b4 = Convert.ToInt32(pass4[1]);

            // АСАБЫЙ СЛУЧАЙ - ОДИНАКОВО ИГРОКИ
            bool svinka = false;
            if (a1 == a3 || a2 == a4 || b1 == b3 || b2 == b4)
                svinka = true;

            // ВИГРЫШ ВТОРОГА
            if ((a3 > a1 && b4 > b2) || (a4 > a1 && b3 > b2))
                if ((a3 > a2 && b4 > b1) || (a4 > a2 && b3 > b1))
                {
                    Console.WriteLine("Team 2");

                    return;
                }

            // ВИГРЫШ ПЕРВАГО
            if ((a1 > a3 && b2 > b4) || (a2 > a3 && b1 > b4))
                if ((a1 > a4 && b2 > b3) || (a2 > a4 && b1 > b3))
                {
                    if (!svinka)
                        Console.WriteLine("Team 1");
                    else
                        Console.WriteLine("Draw");

                    return;
                }

            Console.WriteLine("Draw");

            return;
        }
    }
}


// Submitted by Silithus @ Macau
using System;
using System.IO;
using System.Collections.Generic;
using CCF_XOI;

namespace RCC2014
{
	class QR_C
	{
		private int beat(int a_atk, int a_def, int b_atk, int b_def)
		{
			if (a_atk > b_atk && a_def > b_def) return 1;
			if (b_atk > a_atk && b_def > a_def) return -1;
			return 0;
		}

		public void Solve(XOI xoi)
		{
			int i, j, res, ans;
			int[,] team;
			string[] ans_words = { "Team 2", "Draw", "Team 1" };

			team = new int[4, 2];
			for (i = 0; i < 4; i++)
				for (j = 0; j < 2; j++)
					team[i, j] = xoi.ReadInt();

			for (i = 0, ans = -1999; i <= 1; i++)
			{
				for (j = 2, res = 1999; j <= 3; j++)
					res = Math.Min(res, beat(team[i, 1], team[1 - i, 0], team[j, 1], team[5 - j, 0]));
				ans = Math.Max(ans, res);
			}

			xoi.o.WriteLine(ans_words[ans + 1]);
		}
	}

	class RCC2014_QR
	{
		static void Main(string[] args)
		{
			XOI xoi = new XOI();
			(new QR_C()).Solve(xoi);
		}
	}
}

namespace CCF_XOI
{
	class XOI
	{
		protected StreamReader sr;
		public StreamWriter o;
		protected Queue<string> buf = new Queue<string>();
		public bool EOF = false;

		public XOI()
		{
			this.sr = new StreamReader(Console.OpenStandardInput());
			this.o = new StreamWriter(Console.OpenStandardOutput());
			this.o.AutoFlush = true;
		}

		public XOI(string in_path, string out_path)
		{
			this.sr = new StreamReader(in_path);
			this.o = new StreamWriter(out_path);
			this.o.AutoFlush = true;
		}

		public int ReadInt()
		{
			string s = this.GetNext();
			if (s == null) return -1;
			else return Int32.Parse(s);
		}

		public long ReadLong()
		{
			string s = this.GetNext();
			if (s == null) return -1;
			else return Int64.Parse(s);
		}

		public double ReadDouble()
		{
			string s = this.GetNext();
			if (s == null) return -1;
			else return Double.Parse(s);
		}

		public string ReadString()
		{
			string s = this.GetNext();
			return (s == null ? null : s);
		}

		public string ReadLine()
		{	// I will ignore current buffer and read a new line
			string s = "";
			while (s == "" && !this.EOF)
			{
				s = sr.ReadLine();
				this.EOF = (s == null);
			}
			return (this.EOF ? null : s);
		}

		protected string GetNext()
		{
			if (buf.Count == 0)
			{
				while (buf.Count == 0 && !this.EOF)
				{
					string s = sr.ReadLine();
					if (s == null)
						this.EOF = true;
					else
						foreach (string ss in s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))
							buf.Enqueue(ss);
				}
			}

			return (this.EOF ? null : buf.Dequeue());
		}
	}
}


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

namespace Codeforces_240_2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] S = Console.ReadLine().Split(' ');
            int n = int.Parse(S[0]);
            int k = int.Parse(S[1]);
            long[] dp = new long[12];
            int[] d = new int[12];
            int[] m = new int[12];
            for (d[0] = 1; d[0] <= n; ++d[0])
            {
                ++dp[0];
                int i = 1;
                for (m[i] = 2; ; ++m[i])
                {
                    d[i] = d[i-1] * m[i];
                    if (n < d[i])
                    {
                        if (--i < 1) break;
                    }
                    else
                    {
                        ++dp[i];
                        ++i;
                        m[i] = 1;
                    }
                }
            }
            decimal ret = 0;
            decimal b = 1;
            for (long i = 0; i < 12 && i < k; ++i)
            {
                ret = (ret + b * dp[i]) % 1000000007;
                b = b * (k - 1 - i) / (i + 1);
            }
            Console.WriteLine(ret);
        }
    }
}


// Submitted by Silithus @ Macau
using System;
using System.IO;
using System.Collections.Generic;
using CCF_XOI;

namespace CodeForces
{
	class CF624A
	{
		public void Solve(XOI xoi)
		{
			int L, D, V1, V2;

			D = xoi.ReadInt();
			L = xoi.ReadInt();
			V1 = xoi.ReadInt();
			V2 = xoi.ReadInt();

			xoi.o.WriteLine((double)(L - D) / (double)(V1 + V2));
		}
	}

	class CodeForcesMain
	{
		static void Main(string[] args)
		{
			(new CF624A()).Solve(new XOI());
		}
	}
}

namespace CCF_XOI
{   // version 2014.06.20
	class XOI
	{
		protected StreamReader sr;
		public StreamWriter o;
		protected Queue<string> buf = new Queue<string>();
		public bool EOF = false;

		public XOI()
		{
			this.sr = new StreamReader(Console.OpenStandardInput());
			this.o = new StreamWriter(Console.OpenStandardOutput());
			this.o.AutoFlush = true;
		}

		public XOI(string in_path, string out_path)
		{
			this.sr = new StreamReader(in_path);
			this.o = new StreamWriter(out_path);
			this.o.AutoFlush = true;
		}

		public int ReadInt()
		{
			string s = this.GetNext();
			if (s == null) return -1;
			else return Int32.Parse(s);
		}

		public long ReadLong()
		{
			string s = this.GetNext();
			if (s == null) return -1;
			else return Int64.Parse(s);
		}

		public double ReadDouble()
		{
			string s = this.GetNext();
			if (s == null) return -1;
			else return Double.Parse(s, System.Globalization.CultureInfo.InvariantCulture);
		}

		public string ReadString()
		{
			string s = this.GetNext();
			return (s == null ? null : s);
		}

		public string ReadLine()
		{   // I will ignore current buffer and read a new line
			string s = "";
			while (s == "" && !this.EOF)
			{
				s = sr.ReadLine();
				this.EOF = (s == null);
			}
			return (this.EOF ? null : s);
		}

		protected string GetNext()
		{
			if (buf.Count == 0)
			{
				while (buf.Count == 0 && !this.EOF)
				{
					string s = sr.ReadLine();
					if (s == null)
						this.EOF = true;
					else
						foreach (string ss in s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))
							buf.Enqueue(ss);
				}
			}

			return (this.EOF ? null : buf.Dequeue());
		}
	}
}


using System;
class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            string rs;
            for (int i = 0, cntr = 2; i < input.Length; ++i)
            {
                if (input[i] == '4')
                {
                    if (++cntr > 2) { rs = "NO"; break; }
                }
                else if (input[i] == '1') cntr = 0;
                else { rs = "NO"; break; }
            }
            Console.WriteLine(rs==null?"YES":rs);
        }
    }


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

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    private const int SIEVE_SIZE = 1000;
    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()
    {
        int n = ReadInt();
        int m = ReadInt();

        Sieve();
        for (int i = 0; primes[i] <= n; i++)
        {
            for (int j = 1; j < primes.Count; j++)
                if (primes[j - 1] + primes[j] + 1 == primes[i])
                    m--;
        }

        Write(m > 0 ? "NO" : "YES");
    }

    #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("input.txt");
        //writer = new StreamWriter("output.txt");
#endif
        try
        {
            new Solver().Solve();
            //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();
        }
        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;
using System.Threading.Tasks;
using System.IO;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StreamReader reader = new StreamReader("input.txt");
            StreamWriter writer = new StreamWriter("output.txt");
            string[] int_mass =reader.ReadLine().Split(' ');
            int n = Int32.Parse(int_mass[0]);
            int t = int.Parse(int_mass[1]);
            int k = Int32.Parse(int_mass[2]);
            int d = Int32.Parse(int_mass[3]);
            int Without_furn = t * ((int)(n/k)!=0 ? (int)(n/k) : 1);
            int with_furn = d + t;
            if (with_furn<Without_furn)
                writer.WriteLine("YES");
            else
                writer.WriteLine("NO");
            reader.Close();
            writer.Close();
        }
    }
}


using System;

namespace Carrot_Cakes
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            int n = byte.Parse(input.Split(' ')[0]),
                t = byte.Parse(input.Split(' ')[1]),
                k = byte.Parse(input.Split(' ')[2]),
                d = byte.Parse(input.Split(' ')[3]);
            int withoutSecondoven = 0,
                withSecondoven = 0;
            int i = n;
            bool firstTime = false;
            while(i >0)
            {
                withoutSecondoven += t;
                i -= k;
            }
            int timeLine = 1;
            int ovenStartTime = 0;
            i = n;
            do
            {
                if (timeLine % t == 0)
                {

                    i -= k;

                }
                if(timeLine >= d && i!=0)
                {

                    ovenStartTime++;
                    //second oven built
                    if (ovenStartTime % t == 0)
                    {

                        i -= k;
                    }
                }
                timeLine++;

            } while (i>0);

            if (withoutSecondoven <= timeLine)
            {
                Console.WriteLine("NO");
            }
            else
            {
                Console.WriteLine("YES");
            }
        }
    }
}


using System;

namespace MyFirstAlgOnC#
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int n = input[0], t = input[1], k = input[2], d = input[3];
            int timesCook = (int)Math.Ceiling((double)n / k);
            int timeAlone = timesCook * t;
            bool result = Math.Max(timeAlone - t, d + t) < timeAlone;
            Console.WriteLine(result ? "YES" : "NO");
        }
    }
}


using System;

namespace AllProblems
{
    class _245B_InternetAddress
    {
        public static void Run()
        {
            var s = Console.ReadLine().Trim().Split(new[]{"tp"},StringSplitOptions.None);
            Console.Write("{0}://", s[0].Length == 1 ? "ftp" : "http");
            if (s[1].StartsWith("ru"))
            {
                Console.Write("ru");
                s[1] = s[1].Substring(2);
            }

            var ru = s[1].Split(new[] {"ru"}, 2,StringSplitOptions.None);
            Console.Write("{0}.ru/{1}",ru[0],ru[1]);
            Console.ReadLine();
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            _245B_InternetAddress.Run();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace Codefoeces
{
    class Program
    {

        static void Main(string[] args)
        {

            int t = int.Parse(Console.ReadLine());

            for (int c = 0; c < t; c++)
            {
            string[] s = Console.ReadLine().Split();
            long a = long.Parse(s[0]);
            long b = long.Parse(s[1]);

                bool prost = true;

                long n = a * a - b * b;
                for (long i = 2; i <= n / 2; i++)
                {
                    if (n % i == 0)
                    {
                        prost = false;
                        break;
                    }
                }
                if (prost)
                    Console.WriteLine("YES");
                else
                    Console.WriteLine("NO");
            }
        }
    }
}


using System;

namespace BSE186_Template13
{
    /* ФИО: Малашенко Борис Тарасович
     * Самостоятельная работа №
     * Вариант:
     * Дата:
     * */
    class Program
    {

        static void Bad()
        {
            Console.WriteLine("Something goes wrong, try again...");
        }

        static void Good()
        {
            Console.WriteLine("Excellent!");
        }

        static int ReadNum(string name)
        {
            int a;
            while (true)
            {
                Console.Write($"Input {name}: ");
                string data = Console.ReadLine();
                if (int.TryParse(data, out a))
                {
                    Good();
                    break;
                }
                Bad();
            }
            return a;
        }

        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            for (int i = 0; i < n; ++i)
            {
                var data = Console.ReadLine().Split();
                int a = int.Parse(data[0]);
                int b = int.Parse(data[1]);
                if (a - b > 1)
                    Console.WriteLine("NO");
                else
                    Console.WriteLine("YES");
            }
            //Console.ReadKey();
        }
    }
}


using System;

namespace BSE186_Template13
{
    /* ФИО: Малашенко Борис Тарасович
     * Самостоятельная работа №
     * Вариант:
     * Дата:
     * */
    class Program
    {

        static void Bad()
        {
            Console.WriteLine("Something goes wrong, try again...");
        }

        static void Good()
        {
            Console.WriteLine("Excellent!");
        }

        static int ReadNum(string name)
        {
            int a;
            while (true)
            {
                Console.Write($"Input {name}: ");
                string data = Console.ReadLine();
                if (int.TryParse(data, out a))
                {
                    Good();
                    break;
                }
                Bad();
            }
            return a;
        }

        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            for (int i = 0; i < n; ++i)
            {
                var data = Console.ReadLine().Split();
                ulong a = ulong.Parse(data[0]);
                ulong b = ulong.Parse(data[1]);
                bool prost = false;

                if (a - b > 1)
                {
                    ulong f = a + b;
                    for (ulong j = 2; j <= f / 2; j++)
                    {
                        if (f % j == 0)
                        {
                            prost = true;
                            break;
                        }
                    }

                }
                if (prost)
                {
                    Console.WriteLine("YES");
                }
                else
                {
                    Console.WriteLine("NO");
                }
            }
            //Console.ReadKey();
        }
    }
}


using System;

public class Program
{
	public static void Main()
	{
		long t = Convert.ToInt64(Console.ReadLine());
        string[] tests = new string[2];
		long f;
		long p;
		loop:
        for(long i=0;i<t;i++)
        {
         tests = Console.ReadLine().Split(' ');
         f = (Convert.ToInt64(tests[0])-Convert.ToInt64(tests[1]));
         if(f==0) Console.WriteLine("YES");
		 else {
		 if(f==1)
		 {
			 p = (Convert.ToInt64(tests[0])+Convert.ToInt64(tests[1]));
			 if(p==1) Console.WriteLine("YES");
			 else
			 {
				 if(p%2==0) Console.WriteLine("NO");
				 else
				 {
					 for(long j = 3;j < Math.Sqrt(p)+1;j+=2)
					 {
						 if(p%j==0) {Console.WriteLine("NO"); goto loop;}
					 }
					 Console.WriteLine("YES");
				 }
			 }
		 }
         else Console.WriteLine("NO");
		 }
		}
	}
}


using System;

public class Program
{
	public static void Main()
	{
		long t = Convert.ToInt64(Console.ReadLine());
        string[] tests = new string[2];
		long f;
		long p;
		int kek = 0;
        for(long i=0;i<t;i++)
        {
         tests = Console.ReadLine().Split(' ');
         f = (Convert.ToInt64(tests[0])-Convert.ToInt64(tests[1]));
		 if(f==1)
		 {
			 p = (Convert.ToInt64(tests[0])+Convert.ToInt64(tests[1]));
			 if(p==1) Console.WriteLine("YES");
			 else
			 {
				 if(p%2==0) Console.WriteLine("NO");
				 else
				 {
					 for(long j = 3;j < (p/2)+1;j+=2)
					 {
						 if(p%j==0) {Console.WriteLine("NO");kek = 1;break;}
					 }
					 if(kek!=1) Console.WriteLine("YES");
				 }
			 }
		 }
         else Console.WriteLine("NO");
		}
	}
}


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] y = new string[n];
            bool g=false;
            for (int i = 0; i < n; i++)
            {
                string[] temp = Console.ReadLine().Split(' ');
                Int64 a = Int64.Parse(temp[0]);
                Int64 b = Int64.Parse(temp[1]);

                if (Math.Abs(a - b) == 1)
                {
                    bool f = false;
                    for (Int64 j = 2; j < Math.Sqrt(a + b)+2; j++)
                    {
                        if (((a + b) % j == 0)&&(g<=a+b))
                        {
                            f = true;
                            break;
                        }
                    }
                    if (f)
                        Console.WriteLine("NO");
                    else
                        Console.WriteLine("YES");

                }
                else
                    Console.WriteLine("NO");
            }
        }
    }
}


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

namespace Logo_Turtle
{
    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)
        {
            string s = reader.ReadLine();
            int n = int.Parse(reader.ReadLine());

            int sl = s.Length*2;
            var dp = new bool[n + 1,sl + 1,2];
            dp[0, s.Length, 0] = true;

            foreach (char c in s)
            {
                var next = new bool[n + 1,sl + 1,2];

                for (int i = 0; i <= n; i++)
                {
                    for (int j = 0; j <= sl; j++)
                    {
                        if (dp[i, j, 0])
                        {
                            if (c == 'F')
                            {
                                next[i, j + 1, 0] = true;
                                if (i + 1 <= n) next[i + 1, j, 1] = true;
                            }
                            else
                            {
                                next[i, j, 1] = true;
                                if (i + 1 <= n) next[i + 1, j + 1, 0] = true;
                            }
                        }
                        if (dp[i, j, 1])
                        {
                            if (c == 'F')
                            {
                                next[i, j - 1, 1] = true;
                                if (i + 1 <= n) next[i + 1, j, 0] = true;
                            }
                            else
                            {
                                next[i, j, 0] = true;
                                if (i + 1 <= n) next[i + 1, j - 1, 1] = true;
                            }
                        }
                    }
                }

                dp = next;
            }

            for (int i = s.Length;; i--)
            {
                if (dp[n, s.Length - i, 0] || dp[n, s.Length - i, 1] || dp[n, s.Length + i, 0] || dp[n, s.Length + i, 1])
                {
                    writer.WriteLine(i);
                    break;
                }
            }

            writer.Flush();
        }
    }
}