import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.*;

public class Main implements Runnable {
	private boolean _READ_FROM_FILE = System.getProperty("ONLINE_JUDGE") == null; //System.getSecurityManager() == null; //
	private boolean _WRITE_TO_FILE = false;
	static final String _TASK_ID = "in";
	static final String _IN_FILE = _TASK_ID + ".txt";
	static final String _OUT_FILE = _TASK_ID + ".txt";
	BufferedReader reader;
	StringTokenizer tokenizer;

	private void core() throws Exception {
		int n = nextInt();
		int ka = 1234567;
		int kb = 123456;
		int kc = 1234;
		boolean yes = false;
		for (int a = 0; a <= n/ka; a++) {
			for (int b = 0; b <= (n - a*ka)/kb; b++) {
				int rem = n - a*ka - b*kb;
				if (rem >= 0 && rem % kc == 0) {
					yes = true;
				}
			}
		}
		if (yes) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
	void debug(Object...os) {
		System.out.println(Arrays.deepToString(os));
	}
//--------------------- IO stuffs ---------------------
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(new Main());
        thread.start();
        thread.join();
    }
	public void run() {
        try {
        	reader = new BufferedReader(_READ_FROM_FILE ? new FileReader(_IN_FILE) : new InputStreamReader(System.in));
        	if (_WRITE_TO_FILE) {
        		System.setOut(new PrintStream(new BufferedOutputStream(new FileOutputStream(_OUT_FILE))));;
        	}
            tokenizer = new StringTokenizer("");
            core();
            reader.close();
            System.out.flush();
            System.out.close();
            System.exit(0);
        } catch (Exception e) {
        	System.out.flush();
            e.printStackTrace();
            System.exit(1);
        }
    }
    int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
    String nextToken() throws Exception {
        while (!tokenizer.hasMoreTokens())
			tokenizer = new StringTokenizer(reader.readLine());
        return tokenizer.nextToken();
    }
    boolean nextIsAvailable() throws Exception {
    	while (!tokenizer.hasMoreElements()) {
    		String line = reader.readLine();
    		if (line == null) return false;
    		tokenizer = new StringTokenizer(line);
    	}
    	return true;
    }
}

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

public class B {
	public static int n;
	public static void main(String[] args) throws IOException {
		BufferedReader in= new BufferedReader(new InputStreamReader (System.in));
		long n= Long.parseLong(in.readLine());
		long a= n/1234567;
		long b= n/123456;
		boolean done= false;
		for (int i = 0; i <= a; i++) {
			for (int j = 0; j <= b; j++) {
				long temp= i*1234567+j*123456;
				temp= n-temp;
				if(temp>=0&&temp%1234==0){
					done= true;
				}
			}
		}
		if(done){
			System.out.println("YES");
		}
		else{
			System.out.println("NO");
		}

	}

}

import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Created by hp on 5/18/2017.
 */
public class toto {

    public static void main(String[] args) {

      Scanner in=new Scanner(System.in);
        PrintWriter out=new PrintWriter(System.out);
      int n=in.nextInt();
      int k=n/1234567;
      int l=n/123456;
      for(int i=0;i<=n;i+=1234567)
      {
          for(int j=0;j<=n-i;j+=123456)
          {
              if((n-i-j)%1234==0 )
              {
                  out.print("YES");
                  out.close();
                  return;
              }
          }

      }

  out.print("NO");

      out.close();
    }

}

import java.util.Scanner;

public class C357B {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int i = Integer.parseInt(sc.nextLine().trim());
		boolean answer = false;

		boolean[] b = new boolean[27406118];
		b[0] = true;
		for(int a=1; a<=27406117; a++){
			if((a>=1234 && b[a-1234])||(a>=123456 && b[a-123456])||(a>=1234567 && b[a-1234567])){
				b[a] = true;
			}
		}

		/*while(i>0){

		}*/
		if(i>27406117 || b[i]){
			System.out.print("YES");
		}
		else{
			System.out.print("NO");
		}
	}

}

//package ayman;

import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

//import java.math.*;

public class Main {

	public static void main(String[] args) {

		FileInputStream instream = null;
		try {
			instream = new FileInputStream(
					"D:/Programming/EclipseNeonJava/ayman/src/ayman/input.txt");
			System.setIn(instream);
		} catch (Exception e) {
			System.err.println("Error Occurred. with files");
		}
		Scanner in = new Scanner(System.in);

		// ###########################################################################################################
		// ################################################START######################################################
		// ###########################################################################################################
		int x=in.nextInt();
		long temp;
		for(int i=0;;i++){
			temp=i*1234567;
			if(temp>x) break;
			for(int k=0;;k++){
				temp=i*1234567+k*123456;
				if(temp>x) break;
				if(x-temp>=0&&(x-temp)%1234==0){
					System.out.println("YES");
					return;
				}
			}
		}
		System.out.println("NO");
	}
}

class Pair implements Comparable<Pair> {
	int first, second;

	Pair(int first, int second) {
		this.first = first;
		this.second = second;
	}

	@Override
	public int compareTo(Pair p) {
		return first == p.first ? second - p.second : first - p.first;
	}
}

import java.util.Scanner;

public class EconomyGame {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		long num = 0;
		for(int i = 0; i < 900; i++){
			for(int j = 0; j < 20000; j++){
				num = (i*1234567)+(j*123456);
				if(num > n){
					break;
				}
				if((n-num) % 1234 == 0){
					System.out.println("YES");
					return;
				}
			}
		}
		System.out.println("NO");
	}
}

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

public class B {
    public static void solution(BufferedReader reader, PrintWriter out)
            throws IOException {
        In in = new In(reader);
        long n = in.nextLong();
        boolean found = false;
        for (int r1 = 0; r1 <= n; r1 += 1234567)
            for (int r2 = 0; r1 + r2 <= n; r2 += 123456)
                if ((n - r1 - r2) % 1234 == 0)
                    found = true;
        out.println(found ? "YES" : "NO");
    }

    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(
                new BufferedWriter(new OutputStreamWriter(System.out)));
        solution(reader, out);
        out.close();
    }

    protected static class In {
        private BufferedReader reader;
        private StringTokenizer tokenizer = new StringTokenizer("");

        public In(BufferedReader reader) {
            this.reader = reader;
        }

        public String next() throws IOException {
            while (!tokenizer.hasMoreTokens())
                tokenizer = new StringTokenizer(reader.readLine());
            return tokenizer.nextToken();
        }

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

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

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

import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.*;
import java.util.Scanner;

public class DSU {

    final int MAX = (int) (10e5 + 2);
    int[] parent = new int[MAX];
    int[] rank = new int[MAX];
    int[] total = new int[MAX];

    public DSU(int n) {

        for (int i = 0; i < MAX; i++) {
            parent[i] = i;
        }
    }

    int FindLeader(int node) {
        return (parent[node] == node) ? node : (parent[node] = FindLeader(parent[node]));
    }

    boolean SameSet(int i, int k) {
        return FindLeader(i) == FindLeader(k);
    }

    void MergeGroup(int i, int k) {
        int px = FindLeader(i);
        int py = FindLeader(k);
        if(py==px)return;
            if (rank[px] <= rank[py]) {
                parent[py] = px;
                rank[py]=rank[px];
            } else {
                parent[px] = py;
               rank[px]=rank[py];
            }

    }

    int GetSize(int node) {
        int leader = FindLeader(node);
        return rank[leader];
    }

    public static void main(String[] args) throws IOException {
        Scanner in = new Scanner(System.in);
        try (PrintWriter or = new PrintWriter(System.out)) {
            long n=in.nextLong();
            for (int i = 0; i <=n; i+=1234567) {
                for (int j = 0; j <= n-i; j+=123456) {
                    if((n-i-j)%1234==0){
                        or.print("YES");return;
                    }
                }
            }
            or.print("NO");

        }

    }

}

import java.util.Scanner;

public class x{
    public static void main(String[] args){
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        long r=0;
        int i=0;
        for(i=0;i<=1000;i++){
            while(n-r>=0){
                if((n-r)%1234==0){
                    System.out.println("YES");
                    return ;
                }
                r+=123456;
            }
            r=i*1234567;
        }
        System.out.println("NO");
    }
}

import java.util.Scanner;

public class B {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long maxA = n / 1234567;
        for (long a = 0; a <= maxA; a++) {
            if (a * 1234657 <= n) {
                if (n % 1234567 == 0) {
                    System.out.println("YES");
                    return;
                }
                long n1 = n - a * 1234567;
                long maxB = n1 / 123456;
                for (long b = 0; b <= maxB; b++) {
                    if (b * 123456 <= n1) {
                        long n2 = n1 - b * 123456;
                        if (n2 % 1234 == 0) {
                            System.out.println("YES");
                            return;
                        }
                    }
                }
            }
        }
        System.out.println("NO");
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.*;
public class Q1 {

	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		long a=1000;
		long b=10000;
		long c1 = 1234567;
		long c2 = 123456;
		long c3 = 1234;

		int flag=0;
		for(int i=0;i<=a;i++)
		{
			for(int j=0;j<=b;j++)
			{
				long  x = i*c1+j*c2;
				if((n-x)>=0 && (n-x)%c3==0)
				{
					flag=1;
					break;
				}
			}
			if(flag==1)
				break;
		}
		if(flag==1)
			System.out.println("YES");
		else
			System.out.println("NO");
	}

}
class MyScanner {
	   BufferedReader br;
	   StringTokenizer st;

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

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

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

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

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

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

	}

import java.util.Scanner;

public class Economy {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int f = 1234567; int b = 123456; int s = 1234;
		int fmax = n/f; int bmax = n/b;
		int rem = 0; boolean found = false;
		for(int i = 0; !found && i <= fmax; i++) {
			for(int j = 0; !found && j <= bmax; j++) {
				rem = n - i*f - j*b;
				if(rem >= 0 && (rem%s) == 0) {
					found = true;
					break;
				}
			}
		}
		System.out.println(found ? "YES" : "NO");
		scan.close();
	}
}

import java.util.Scanner;

/**
 * Created on 14.06.2016.
 */
public class task2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long n = in.nextLong();
        long tek;
        String rez = "NO";
        for (long i = 0; i < 812; i++) {
            //tek=i*1234567;
            for (long j = 0; (j < 8102)&&(i*1234567+j*123456<=n); j++) {
                tek=i*1234567+j*123456;
                if ((n-tek)%1234==0){
                    rez="YES";
                    break;
                }
            }
            if(rez.equals("YES")){
                break;
            }
        }
        System.out.println(rez);
    }
}

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

public class CF_681_B {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		long n = Integer.parseInt(br.readLine());
		boolean can = false;
		for (int a = 0; a <= n/1234567; a++) {
			for (int b = 0; b <= n/123456; b++) {
				long first = a * 1234567;
				long sec = b * 123456;
				if ( n >= first + sec && (n - first - sec) % 1234 == 0){
					can = true;
					break;
				}

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

	}
}

import java.util.Scanner;

public class ConsoleApplication {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        String ans = "NO";
        for (int a = 0; a <= n; a += 1234567) {
            for (int b = 0; b <= n - a; b += 123456) {
                if ((n - a - b) % 1234 == 0) {
                    ans = "YES";
                }
            }
        }
        System.out.println(ans);

    }//End main funciton.

}//End ConsoleApplication Class.

import java.io.*;

public class B681
{
	public static void main(String[] ar) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		long n = Long.parseLong(br.readLine());
		long HOUSE_COST=1234567;
		long CAR_COST=123456;
		long COMPUTER_COST=1234;

		long maxHouses = n / HOUSE_COST;
		long maxCars = n / CAR_COST;
		long maxComputers = n / COMPUTER_COST;

		boolean found = false;

		for(long i=0; i<=maxHouses; i++)
		{
			for(long j=0; j<=maxCars; j++)
			{
				long remainderSpend = n - (i*HOUSE_COST + j*CAR_COST);
				if(remainderSpend >= 0 && remainderSpend % COMPUTER_COST == 0)
				{
					found = true;
					break;
				}
			}
			if(found)
				break;
		}

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

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

public class R357B {
	public static void main(String[] args) throws IOException, NumberFormatException {
		BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		Scanner s = new Scanner(System.in);

		int n = s.nextInt();
		long start = System.currentTimeMillis();
		int house = 1234567, car = 123456, comp = 1234;
		int a = 0, b = 0, c = 0;
		boolean flag = false;
		int aLim = n/house, bLim = n/car, cLim = n/comp;
		for(int i = 0; i <= aLim; i++) {
			int j = 0;
			int k = cLim;
			while(k >= 0) {
				int val = i*house + j*car + k*comp;
//				System.out.printf("%d %d %d: %d\n", i, j, k, val);
				if(val == n) {
					flag = true; break;
				} else if(val > n) k--;
				else j++;
			}
			if(flag) break;
		}
		System.out.println(flag ? "YES" : "NO");
//		System.out.println(System.currentTimeMillis()-start);
	}
}

import java.util.*;
import java.io.*;
//558A
public class Test{
	public static void main(String[] args) throws Exception{

		InputReader sc = new InputReader(System.in);
		PrintWriter wr = new PrintWriter(System.out);
		int n=sc.nextInt();
	//	int flag=0;
//		n=1000000000;
		if(n>30000000){
			System.out.println("YES");
			return;
		}
		int h=1234567;
		if(n%h==0) {
			System.out.println("YES");
			return;
		//	flag=1;
		}
		int cr=123456;
		if(n%cr==0){
		//	flag=1;
			System.out.println("YES");
			return;
		}
		int cmp=1234;
		if(n%cmp==0){
			System.out.println("YES");
			return;
			//flag=1;
		}
		for(int i=0;i*h<=n;i++){
			//if(i*h>=n)
			for(int j=0;i*h+cr*j<=n;j++){
				//if(i*h+cr*j>=n)
				for(int k=0;i*h+cr*j+k*cmp<=n;k++){
					if(i*h+cr*j+k*cmp==n){
						System.out.println("YES");
						return;
					//	flag=1;
					}
				}
			}
		}
		System.out.println("NO");

	}
	public static int GCD(int value1, int value2)
    {
        while (value1 != 0 && value2 != 0)
        {
            if (value1 > value2)
                value1 %= value2;
            else
                value2 %= value1;
        }
        return Math.max(value1, value2);
    }
	public static long power(long a,long b)
	{
	    long ans=1;
	    while(b>0)
	    {
	        if(b%2==1)
	        {
	            ans*=a;
	            ans=ans%1000000007;
	        }
	        a*=a;
	        a=a%1000000007;
	        b/=2;
	    }
	    return ans%1000000007;
	}
}
class InputReader{
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

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

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

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

	public int nextInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public long nextLong() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String nextToken() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public String nextLine() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isEndOfLine(c));
		return res.toString();
	}

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

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

	public void pArray(int[] arr){
		for (int i=0; i<arr.length; i++) {
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	public void pArray(long[] arr){
		for (int i=0; i<arr.length; i++) {
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}

	private boolean isEndOfLine(int c) {
		return c == '\n' || c == '\r' || c == -1;
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}

}

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

public class jam{
   public static void main(String[] args) {
      MyScanner sc = new MyScanner();
      out = new PrintWriter(new BufferedOutputStream(System.out));

      // Start writing your solution here. -------------------------------------
      int n = sc.nextInt();
      boolean flag = false;
      for (int i =n/1234567;i>=0 && !flag;i--){
    	  for (int j=n/123456;j>=0 && !flag;j--){
    		  for (int m=n/1234;m>=0 && !flag;m--){
    			  if(n-(i*1234567+j*123456+m*1234)==0){
    				  flag=true;
    				  break;
    			  }
    			  if((n-(i*1234567+j*123456))%1234!=0) break;
    		  }
    	  }
      }
      if(flag) out.println("YES");
      else out.println("NO");
      // Stop writing your solution here. -------------------------------------
      out.close();
   }

   //-----------PrintWriter for faster output---------------------------------
   public static PrintWriter out;

   //-----------MyScanner class for faster input----------
   public static class MyScanner {
      BufferedReader br;
      StringTokenizer st;

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

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

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

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

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

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

   }
   //--------------------------------------------------------
}

import java.util.Scanner;

/**
 * Created by m.shakhan on 16.06.2016.
 */
public class Test {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long total = in.nextLong();
        int n1 = (int) (total / 1234567);
        int n2 = (int) (total / 123456);
        boolean yes = false;
        if(total%1234567 == 0 || total % 123456 == 0 || total% 1234 == 0){
            System.out.println("YES");
            System.exit(0);
        }
        while (n1 > 0 || n2 > 0) {
            if (n1 * 1234567 + n2 * 123456 <= total && (total - (n1 * 1234567 + n2 * 123456)) % 1234 == 0) {
                yes = true;
                break;
            }
            if (n2 > 0) {
                n2--;
            } else if (n1 > 0 && n2 == 0) {
                n2 = (int) (total / 123456);
                n1--;
            }
        }
        System.out.println(yes ? "YES" : "NO");
    }
}

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;

public class Q2 {
	static long MOD = 1000000007;
	static boolean b[];
	static ArrayList<Integer>[] amp;
	static long sum[];
	static long ans = 0;
	static FasterScanner sc = new FasterScanner();
	static Queue<String> q = new LinkedList<>();
	static ArrayList<String>[] arr;
	public static void main(String[] args) throws IOException {
		BufferedWriter log = new BufferedWriter(new OutputStreamWriter(System.out));
		int n = sc.nextInt();
		if(n<1234) System.out.println("NO");
		else {
			for(int i = 0;i<=n/1234567;i++){
				for(int j = 0;j<=n/123456;j++){
					if((n-1L*i*1234567-1L*j*123456)>=0 && (n-1L*i*1234567-1L*j*123456)%1234==0)
					{
						System.out.println("YES");
						System.exit(0);
					}
				}
			}
			System.out.println("NO");
		}
		log.close();
	}
	static int p = 0;
	static long findDiff(long[] arr, long[] brr, int m){
		int i = 0, j = 0;
		long fa = 1000000000000L;
		while(i<m && j<m){
			long x = arr[i]-brr[j];
			if(x>=0){
				if(x<fa) fa = x;
				j++;
			}
			else{
				if((-x)<fa) fa = -x;
				i++;
			}
		}
		return fa;
	}
	public static long max(long x, long y, long z){
		if(x>=y && x>=z) return x;
		if(y>=x && y>=z) return y;
		return z;
	}
	public static void bfs(){
		if(!q.isEmpty()){
			String x = q.poll();
			int y = Integer.parseInt(q.poll());
			arr[p].add(x);
			//System.out.println(x+" "+y+" "+p);
			for(int i= 0;i<y;i++){
				p++;
				bfs();
				p--;
			}
		}
	}
	public static void buildGraph(int n){
		for(int i =0;i<n;i++){
			int x = sc.nextInt(), y = sc.nextInt();
			amp[--x].add(--y);
			amp[y].add(x);
		}
	}
	public static void dfs(int x){
		ans++;
		b[x] = true;
		for(int i =0 ;i<amp[x].size();i++){
			if(!b[amp[x].get(i)]){
				dfs(amp[x].get(i));
			}
		}
	}
	public static void seive(long n){
		b = new boolean[(int) (n+1)];
		Arrays.fill(b, true);
		for(int i = 2;i<=n;i++){
			if(b[i]){
				for(int p = 2*i;p<=n;p++){
					b[p] = false;
				}
			}
		}
	}
	static long modInverse(long a, long mOD2){
	            return  power(a, mOD2-2, mOD2);
	}
	static long power(long x, long y, long m)
	{
	    if (y == 0)
	        return 1;
	    long p = power(x, y/2, m) % m;
	    p = (p * p) % m;

	    return (y%2 == 0)? p : (x * p) % m;
	}
	static long power2(long x,BigInteger y,long m){
		long ans = 1;
		BigInteger two = new BigInteger("2");
		while(y.compareTo(BigInteger.ZERO)>0){
			if(y.getLowestSetBit()==y.bitCount()){
				x = (x*x)%MOD;
				y = y.divide(two);
			}
			else{
				ans = (ans*x)%MOD;
				y = y.subtract(BigInteger.ONE);
			}
		}
		return ans;
	}
	static BigInteger power2(BigInteger x, BigInteger y, BigInteger m){
		BigInteger ans = new BigInteger("1");
		BigInteger one  = new BigInteger("1");
		BigInteger two  = new BigInteger("2");
		BigInteger zero  = new BigInteger("0");
		while(y.compareTo(zero)>0){
			//System.out.println(y);
			if(y.mod(two).equals(one)){
				ans = ans.multiply(x).mod(m);
				y = y.subtract(one);
			}
			else{
				x = x.multiply(x).mod(m);
				y = y.divide(two);
			}
		}
		return ans;
	}
	static BigInteger power(BigInteger x, BigInteger y, BigInteger m)
	{
	    if (y.equals(0))
	        return (new BigInteger("1"));
	    BigInteger p = power(x, y.divide(new BigInteger("2")), m).mod(m);
	    p = (p.multiply(p)).mod(m);

	    return (y.mod(new BigInteger("2")).equals(0))? p : (p.multiply(x)).mod(m);
	}
	static long d,x,y;
	public static void extendedEuclidian(long a, long b){
		if(b == 0) {
	        d = a;
	        x = 1;
	        y = 0;
	    }
	    else {
	        extendedEuclidian(b, a%b);
	        int temp = (int) x;
	        x = y;
	        y = temp - (a/b)*y;
	    }
	}

	public static long gcd(long n, long m){
		if(m!=0) return gcd(m,n%m);
		else return n;
	}

	static class Pair implements Comparable<Pair> {
		int u;
		int v;
		public Pair(){

		}
		public Pair(int u, int v) {
			this.u = u;
			this.v = v;
		}

		public int hashCode() {
			int hu = (int) (u ^ (u >>> 32));
			int hv = (int) (v ^ (v >>> 32));
			return 31*hu + hv;
		}

		public boolean equals(Object o) {
			Pair other = (Pair) o;
			return (u == other.u && v == other.v);
		}

		public int compareTo(Pair other) {
			return Integer.compare(u, other.u) != 0 ? (Integer.compare(u, other.u)) : (Integer.compare(v, other.v));
		}

		public String toString() {
			return "[u=" + u + ", v=" + v + "]";
		}
	}
	public static class FasterScanner {
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = System.in.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

	    public int[] nextIntArray(int n) {
	        return nextIntArray(n, 0);
	    }

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

	    public long[] nextLongArray(int n) {
	    	return nextLongArray(n, 0);
	    }

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

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

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
	}
}

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

public class B {

    void solve() {
        int n = in.nextInt();
        int a = 1234567;
        int b = 123456;
        int c = 1234;
        for (int i = 0; i < (int) 1e9 / a + 1; i++) {
            int sum = a * i;
            if (sum > n){
                break;
            }
            for (int j = 0; j < (int) 1e9 / b + 1; j++) {
                sum = a*i + b*j;
                if (sum > n){
                    break;
                }
                if ((n-sum)%c == 0){
                    out.println("YES");
                    return;
                }
            }
        }
        out.println("NO");
    }

    FastScanner in;
    PrintWriter out;

    void run() {
        try {
            in = new FastScanner(new File("B.in"));
            out = new PrintWriter(new File("B.out"));

            solve();

            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    void runIO() {

        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

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

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

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

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

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

    public static void main(String[] args) {
        new B().runIO();
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class div2B {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer token = new StringTokenizer("");
        int a = Integer.parseInt(br.readLine());
        for (int i = 0;i<=a/1234567;i++){
        	for (int j = 0;j<=a/123456;j++){
        		if (((a-1234567*i-123456*j)%1234==0)&&(a-1234567*i-123456*j>=0)){
        			System.out.println("YES");
        			return;
        		}
        	}
        }
        System.out.println("NO");

    }
}

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

public class B{

	public static final int c1 = 1234567;
	public static final int c2 = 123456;
	public static final int c3 = 1234;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

      	int n = sc.nextInt();

      	int m = n/c1;

      	boolean f = false;

      	for (int i = 0; i<=m; i++) {

      		int k = n/c2;
      		int nn = n;
      		for (int j = 0; j<=k; j++) {
      			if (nn%c3 == 0) {
      				f = true;
      				break;
      			}
      			nn -= c2;
      		}
      		if (f) {
      			break;
      		}
      		n -= c1;
      	}

        out.println(f?"YES":"NO");

        out.close();
        sc.close();
    }
}

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

import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.text.*;

/**
 *
 * @author zulkan
 */
public class cf681b {

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter out = new PrintWriter(System.out);
    static Scanner sc = new Scanner(System.in);

    public static String getString() {
        try {
            return br.readLine();
        } catch (Exception e) {
        }
        return "";
    }

    public static Integer getInt() {
        try {
            return Integer.parseInt(br.readLine());
        } catch (Exception e) {
        }
        return 0;
    }

    public static Integer[] getIntArr() {
        try {
            StringTokenizer temp = new StringTokenizer(br.readLine());
            int n = temp.countTokens();
            Integer temp2[] = new Integer[n];
            for (int i = 0; i < n; i++) {
                temp2[i] = Integer.parseInt(temp.nextToken());
            }
            return temp2;
        } catch (Exception e) {
        }
        return null;
    }

    public static Long[] getLongArr() {
        try {
            StringTokenizer temp = new StringTokenizer(br.readLine());
            int n = temp.countTokens();
            Long temp2[] = new Long[n];
            for (int i = 0; i < n; i++) {
                temp2[i] = Long.parseLong(temp.nextToken());
            }
            return temp2;
        } catch (Exception e) {
        }
        return null;
    }

    public static String[] getStringArr() {
        try {
            StringTokenizer temp = new StringTokenizer(br.readLine());
            int n = temp.countTokens();
            String temp2[] = new String[n];
            for (int i = 0; i < n; i++) {
                temp2[i] = (temp.nextToken());
            }
            return temp2;
        } catch (Exception e) {
        }
        return null;
    }

    public static void print(Object a) {
        out.print(a);
    }

    public static void println(Object a) {
        out.println(a);
    }

    public static void printf(String s, Object... a) {
        out.printf(s, a);
    }

    public static int nextInt() {
        return sc.nextInt();
    }

    public static double nextDouble() {
        return sc.nextDouble();
    }

    public static void main(String[] ar) {
        cf681b c = new cf681b ();
        c.solve();
        out.flush();
    }
    public void solve(){
        long a = 1234567, b = 123456, c = 1234;
        long n = getInt();

        for(int i = 0;i < 10000;i++) {
            for(int j =0 ;i * a + b * j <= n;j++) {
                long t = i * a + b * j;
                long sisa = n - t;
                if(sisa % c == 0) {
                    println("YES");
                    return;
                }
            }

        }
        println("NO");

    }

}

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

public class C {

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        StringBuilder sb = new StringBuilder();
        int n = sc.nextInt();
        int x = n / 1234;
        int y = n / 56;
        for (int i = 0; i <= 1000; ++i)
            for (int j = 0; j <= 100; ++j)
                if ((n - ((56 * (i + 10 *j)) + (7 * j) + 1234 * (1000 * j + 100 * i))) >=0 &&  (n - ((56 * (i + 10 *j)) + (7 * j) + 1234 * (1000 * j + 100 * i)))% 1234 == 0) {
                    System.out.println("YES");
                    return;
                }
        System.out.println("NO");
        out.flush();
        out.close();
    }

    static class Scanner
    {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

        public String next() throws IOException
        {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

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

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

        public String nextLine() throws IOException {return br.readLine();}

        public double nextDouble() throws IOException
        {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if(x.charAt(0) == '-')
            {
                neg = true;
                start++;
            }
            for(int i = start; i < x.length(); i++)
                if(x.charAt(i) == '.')
                {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                }
                else
                {
                    sb.append(x.charAt(i));
                    if(dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg?-1:1);
        }

        public boolean ready() throws IOException {return br.ready();}

    }
}

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

public class R357Dvi2B {
	public static void main(String[] args) {
		FastScanner in=new FastScanner();
		int n=in.nextInt();
		int maxa=n/1234567;
		int maxb=n/123456;
		boolean ans=false;

		if(n%1234567==0||n%123456==0||n%1234==0)
			ans=!ans;
		else{
			int tempa=0,tempb=0;
			for(int i=0;i<=maxa&&!ans;i++){
				tempb=0;
				for(int j=0;j<=maxb&&!ans;j++){
					if(tempa+tempb>n) break;
					if(tempa+tempb<=n&&(n-tempa-tempb)%1234==0){
						ans=!ans;
					}
					tempb+=123456;
				}
				tempa+=1234567;

			}
		}
		System.out.println(ans?"YES":"NO");
	}
	static class FastScanner{
		BufferedReader br;
		StringTokenizer st;
		public FastScanner(){br=new BufferedReader(new InputStreamReader(System.in));}
		String nextToken(){
			while(st==null||!st.hasMoreElements())
				try{st=new StringTokenizer(br.readLine());}catch(Exception e){}
			return st.nextToken();
		}
		int nextInt(){return Integer.parseInt(nextToken());}
		long nextLong(){return Long.parseLong(nextToken());}
		double nextDouble(){return Double.parseDouble(nextToken());}
	}
}

import java.util.Scanner;

public class EconomyGameB {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

         int a = 0;
         int b = 0;
         int c = 0;

         int va = 1234567;
         int vb = 123456;
         int vc = 1234;

         int remA = n;
         int remB = n;
         int remC = n;

         while(remA != 0 && remB != 0 && remC != 0)
         {

                 remB = remC;
                 b = 0;
             while(remA != 0 && remB != 0 && remC != 0)
             {

                 remA = remB;
                 a = 0;
                 while(remA != 0 && remB != 0 && remC != 0)
                 {
                     if(remA % va == 0) { a = remA / va; remA = 0; }
                     else break;
                 }
                 b++;
                 remB -=  vb;
                 if(remB < 0) break;

             }
              c++;
              remC -=  vc;
             if(remC < 0) break;

         }

        // System.out.println(a+" "+b+" "+c);
         if(remA == 0 || remB == 0 || remC ==0 || n == 0)System.out.println("Yes");
         else System.out.println("No");

    }

}

import java.util.Arrays;
import java.util.Scanner;

public class Solution {

    public static void main(String[] args) {
    	try (Scanner scanner = new Scanner(System.in)) {
	    	int N = scanner.nextInt();

	    	int[] houses = new int[N/1234567+1];
	    	int[] cars = new int [N/123456+1];
	    	int[] comp = new int[N/1234+1];

	    	for(int i = 1; i < houses.length; i++) {
	    		houses[i] = i * 1234567;
	    	}

	    	for(int i = 1; i < cars.length; i++) {
	    		cars[i] = i * 123456;
	    	}

	    	for(int i = 1; i < comp.length; i++) {
	    		comp[i] = i * 1234;
	    	}

	    	for(int i = 0; i < houses.length; i++) {
	    		for(int j = 0; j < cars.length; j++) {
	    			if(Arrays.binarySearch(comp, N - houses[i] - cars[j]) > -1) {
	    				System.out.println("YES");
	    				return;
	    			}
	    		}
	    	}

    	System.out.println("NO");
    	}
    }
}

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

public class Solution {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextInt();
		int count = 0;
		for ( long a = 0; a <= n / 1234567; a++) {
			if (n - a * 7 >= 0) {
				for (long b = 0; b <= n / 123456; b++) {
					long diff = n - a * 7 - 56 * (a * 10 + b);
					if ( diff >= 0 && diff % 1234 == 0) {
						diff /= 1234;
						long c = diff - a * 1000 - b * 100;
						if (c >= 0) {
							count++;
							break;
						}
					}
				}
				if (count > 0) {
					break;
				}
			} else {
				break;
			}
		}
		System.out.println(count > 0 ? "YES" : "NO");
	}
}

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

public class CF681B{

	private static InputStream stream;
	private static byte[] buf = new byte[1024];
	private static int curChar;
	private static int numChars;
	private static SpaceCharFilter filter;
	private static PrintWriter pw;

	private static void soln(){
		int n = nextInt();
		boolean flag = false;
		for (int a=0 ;a<=810 && !flag; a++) {
			for (int b=0; b<=8100 && !flag; b++) {
				double c = (n-a*1234567 - b*123456)/1234.0;
				if(Math.ceil(c) == c && c>=0){
//					pw.println(a + " " + b +" " +  c);
					flag = true;
				}
			}
		}
		pw.println(flag ? "YES" : "NO");
	}

	public static void main(String[] args){
		InputReader(System.in);
		pw = new PrintWriter(System.out);
		soln();
		pw.close();
	}

	// To Get Input
	// Some Buffer Methods

	public static void InputReader(InputStream stream1) {
		stream = stream1;
	}

	private static boolean isWhitespace(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	private static boolean isEndOfLine(int c) {
		return c == '\n' || c == '\r' || c == -1;
	}

	private static int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	private static int nextInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	private static long nextLong() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	private static String nextToken() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	private static String nextLine() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isEndOfLine(c));
		return res.toString();
	}

	private static int[] nextIntArray(int n) {
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nextInt();
		}
		return arr;
	}

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

	private static void pArray(int[] arr){
		for (int i=0; i<arr.length; i++) {
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	private static void pArray(long[] arr){
		for (int i=0; i<arr.length; i++) {
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	private static boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}

	private interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}

}

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

public class EconomyGame {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		boolean ok = false;

		int maxa = (n - 1234)/1234567 + 1;
		int maxb = (n - 1234)/123456 + 1;

		for(int a=0; a<=maxa && !ok; a++){
			for(int b=0; b<=maxb && !ok; b++){
				int c = n - 1234567*a - 123456*b;
				int div = c / 1234;
				if(div < 0) break;
				if(c % 1234 == 0){
					ok = true;
				}
			}
		}

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

	}

}

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

public class C681_B {

    public static void main(String[] args) throws IOException {
        IOHelper ioh = new IOHelper();

        long n = ioh.nextLong();

            test(n);

    }

    private static void test(long n) {
        boolean found = false;
        for(long i=0;i<=810;i++){
            for(long j=0;j<=8100;j++){

                    long l = i*1234567L + j*123456L;

                    if(l > n)
                        break;

                    if((n-l)%1234L ==0){
                        found = true;
                        break;
                    }

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

    private static class IOHelper {
        private InputStreamReader isr = new InputStreamReader(System.in);
        private BufferedReader br = new BufferedReader(isr);
        private StringTokenizer tokenizer;

        public String next() throws IOException {
            while(tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(br.readLine());
            }
            return tokenizer.nextToken();
        }

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

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

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

}

	/*
	 * Code Author: abhishek.j.patel---FloREaCeNTa---NO PAIN NO GAIN---DAIICT---
	 */
	import java.io.*;
	import java.math.BigInteger;
	import java.math.RoundingMode;
	import java.text.DecimalFormat;
	import java.util.*;

	public class Tester {

		static double eps=(double)1e-6;
		static long mod=(int)1e9+7;
		public static void main(String args[]){
			InputReader in = new InputReader(System.in);
			OutputStream outputStream = System.out;
			PrintWriter out = new PrintWriter(outputStream);
			//----------My Code----------
			int n=in.nextInt();
	        int ans=0;
	        int n1=1359257;
	        int y=0;
	        int l1=n/1234567;
	        int l2=n/123456;
	        int l3=n/1234;
	        int f1=0;
	        int f2=0;
	        int f3=0;
	        int num1=0;
	        int num2=0;int num3=0;

	        for(int i=0;i<=l1;i++){
	        	for(int j=0;j<=l2;j++){

	        			num1=(1234567*i);num2=(123456*j);
	        		int y1=n-(num1+num2);

	        	if(y1>=0&&y1%1234==0){y=1;break;}

	        		}if(y==1)break;
	        	}

	        if(y!=0)
	        out.println("YES");
	        else out.println("NO");
			out.close();
			//---------------The End------------------

		}

		static class Point implements Comparable<Point>
	    {
	        long x,y;
	        int id;
	        Point(long x, long y, int id)
	        {
	            this.x=x;
	            this.y=y;
	            this.id=id;
	        }

	        long inner(Point p)
	        {
	            return x*p.x+y*p.y;
	        }
	        long cross(Point p)
	        {
	            return x*p.y - y*p.x;
	        }
	        int getSide()
	        {
	            return (y>0 || (y==0 && x>0))?-1:1;
	        }
	        public int compareTo(Point point)
	        {
	            int side1=getSide();
	            int side2=point.getSide();
	            if(side1!=side2)
	                return side1-side2;
	            return Long.signum(point.cross(this));
	        }
	        public String toString()
	        {
	            return "("+x+","+y+")";
	        }
	    }
		static long modulo(long a,long b,long c) {
			long x=1;
			long y=a;
			while(b > 0){
				if(b%2 == 1){
					x=(x*y)%c;
				}
				y = (y*y)%c; // squaring the base
				b /= 2;
			}
			return  x%c;
		}
		static long gcd(long x, long y)
		{
			if(x==0)
				return y;
			if(y==0)
				return x;
			long r=0, a, b;
			a = (x > y) ? x : y; // a is greater number
			b = (x < y) ? x : y; // b is smaller number
			r = b;
			while(a % b != 0)
			{
				r = a % b;
				a = b;
				b = r;
			}
			return r;
		}
		static class Pair implements Comparable<Pair>{
			long x;
			long y;
			int i;
			Pair(long xx,long yy){
				x=xx;
				y=yy;
			}
			@Override
			public int compareTo(Pair o) {
				if(this.y>=o.y)
					return 1;
				else
					return 0;

			}
		}

		static class InputReader {
			public BufferedReader reader;
			public StringTokenizer tokenizer;

			public InputReader(InputStream inputstream) {
				reader = new BufferedReader(new InputStreamReader(inputstream));
				tokenizer = null;
			}

			public String nextLine(){
				String fullLine=null;
				while (tokenizer == null || !tokenizer.hasMoreTokens()) {
					try {
						fullLine=reader.readLine();
					} catch (IOException e) {
						throw new RuntimeException(e);
					}
					return fullLine;
				}
				return fullLine;
			}
			public String next() {
				while (tokenizer == null || !tokenizer.hasMoreTokens()) {
					try {
						tokenizer = new StringTokenizer(reader.readLine());
					} catch (IOException e) {
						throw new RuntimeException(e);
					}
				}
				return tokenizer.nextToken();
			}
			public long nextLong() {
				return Long.parseLong(next());
			}
			public int nextInt() {
				return Integer.parseInt(next());
			}
		}
	}

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

public class B2 {

    public static void main(String[] args) throws IOException {
        br = new BufferedReader( new InputStreamReader(System.in) );
        st = new StringTokenizer("");
        sb = new StringBuilder();

        int num = nxtInt();
        boolean done = false;
        for (int i = 0; i < 900; i++) {
        	for (int j = 0; j < 9000; j++) {
        		long sum = 1234567*i + 123456 *j;
        		if (sum > num)
        			break;

        		if((num-sum) % 1234 == 0) {
        			done = true;
        			System.out.println("YES");
        			break;
        		}
        	}
        	if (done)
        		break;
        }
        if (!done)
        	System.out.println("NO");

    }

    static BufferedReader br;
    static StringTokenizer st;
    static StringBuilder sb;
    static FileReader fr;

    static String nxtTok() throws IOException {
        while (!st.hasMoreTokens()) {
            String s = br.readLine();
            if (s == null)
                return null;
            st = new StringTokenizer(s.trim());
        }
        return st.nextToken();
    }

    static int nxtInt() throws IOException {
        return Integer.parseInt(nxtTok());
    }

    static long nxtLng() throws IOException {
        return Long.parseLong(nxtTok());
    }

    static double nxtDbl() throws IOException {
        return Double.parseDouble(nxtTok());
    }

    static int[] nxtIntArr(int n) throws IOException {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nxtInt();
        return a;
    }

    static long[] nxtLngArr(int n) throws IOException {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nxtLng();
        return a;
    }

    static char[] nxtCharArr() throws IOException {
        return nxtTok().toCharArray();
    }
}

import java.util.Scanner;

public class bhhh {

	public static void main(String[] args) {

		Scanner	sc = new Scanner (System.in);
			int n = sc.nextInt();

			long a=1234567;
			long b=123456;
			long c=1234;
			long p=0;
	int h=0;boolean f= true;
			for(int k=0 ;k<1000 && f ;k++){
				for (int j=0;j<10000 && f;j++){

						p=n-(a*k+b*j);
						    if (p%c==0 && p>=0){
							        System.out.println("YES");
							        h++;
							        f=false;

				}

				}

			}if(h==0)
				System.out.println("NO");

			}

}

    import java.util.*;
    import java.math.*;
    import java.io.*;
    import java.text.DecimalFormat;
    import java.math.BigInteger;
    public class Main{
        static int d=20,n;
        static int mod=1000000007 ;
        static HashMap<String,Integer> hm=new HashMap<>();
        public static void main(String[] args)  throws IOException {
            s.init(System.in);

            PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
            long n;
            n=s.nl();
            int flag=0;
            //int[] dp=new int[10000];
            long a,b,c;
            a=1234567l;
            b=123456l;
            c=1234l;
            for(int i=0;i<=1000;i++){
                if(i*a > n)
                    break;
                for(int j=0;j<=10000;j++){
                    long d=i*a+j*b;
                    if(d>n)
                        break;
                    else if((n-d)%c==0){
                        flag=1;
                        break;
                    }
                }
                if(flag==1)
                    break;

            }
            if(flag==1)
                out.println("YES");
            else
                out.println("NO");

            out.close();

       }

        public static class s {
            static BufferedReader reader;
            static StringTokenizer tokenizer;

            /** call this method to initialize reader for InputStream */
            static void init(InputStream input) {
                reader = new BufferedReader(
                            new InputStreamReader(input) );
                tokenizer = new StringTokenizer("");
            }

            /** get next word */
            static String ns() throws IOException {
                while ( ! tokenizer.hasMoreTokens() ) {
                    //TODO add check for eof if necessary
                    tokenizer = new StringTokenizer(
                        reader.readLine() );
                }
                return tokenizer.nextToken();
            }

            static int ni() throws IOException {
                return Integer.parseInt( ns() );
            }

            static double nd() throws IOException {
                return Double.parseDouble( ns() );
            }
            static long nl() throws IOException {
                return Long.parseLong( ns() );
            }

        }
    }

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

public class CF681B {
    public static void main(String[] args) {
        FastReader input = new FastReader();
        PrintWriter pw = new PrintWriter(System.out);

        int house = 1234567;
        int car = 123456;
        int computer = 1234;
        int n = input.nextInt();

        boolean con = false;

        for(int i = 0;i * house <= n;i++){
            for(int j = 0; i * house + j * car <= n;j++){
                if((n - (i * house + j * car)) % computer == 0){
                    con = true;
                }
            }
        }
        if(con)
            pw.println("YES");
        else
            pw.println("NO");

        // ****If sorting is required, use ArrayList
        pw.flush();
        pw.close();
    }
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

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

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

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

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

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

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

import java.util.Scanner;

public class A {
	public static void main(String cd[]){
		Scanner in=new Scanner(System.in);
		int n=in.nextInt();
		for(int i=0;i<=110;i++){
			for(int j=0;j<=1111;j++){
				long x=i*1234567L+j*123456L;
				if(n-x>=0){
					if((n-x)%1234==0){
						System.out.println("Yes");
						return;
					}
				}
				else{
					break;
				}
			}
		}
		System.out.println("No");
	}
}

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

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{

	public static void main (String[] args) throws java.lang.Exception
	{
	  int n;
	  int ans=0;
	  Scanner sc = new Scanner(System.in);
	  n=sc.nextInt();
	  for(int i=0;i<850;i++){
	      for(int j=0;j<8200;j++){
	          if((n-i*1234567-j*123456)>=0 &&(n-i*1234567-j*123456)%1234==0){
                System.out.println("YES");
                ans=1;
                break;
	          }
	      }
	      if(ans==1) break;
	  }
	  if(ans==0) System.out.println("NO");
	}
}

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

public class EconomyGame {

	public static void main(String[] args) throws IOException {
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(bf.readLine());
		int a = n / 1234567, b = n / 123456, ans;
		boolean isPossible = false;

		for (int i = 0; i <= a; i++) {
			for (int j = 0; j <= b; j++) {
				ans = n - i * 1234567 - j * 123456;
				if ((ans >= 0) && (ans % 1234 == 0)) {
					isPossible = true;
					break;
				}
			}
			if(isPossible){
				break;
			}
		}

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

	}
}

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc =new Scanner(System.in);
		int res,a,max_a,b,max_b,c,x,y,z,i,j,k,t;
		res=sc.nextInt();
		x= 1234567;
		y= 123456;
		z=1234;
		max_a=res/x;
		max_b=res/y;

		for(i=0;i<=max_a;i++){
			for(j=0;j<=max_b;j++){
				t=res-i*x-j*y;
				if(t<0) break;
				if(t%z==0){
				    System.out.println("YES");
				return;
				}
			}
		}
		System.out.println("NO");
	}

}

import java.util.*;
import java.io.*;
import java.math.*;
public class Tester {
	public static void main(String args[])
	{
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		long n=in.nextInt();
		int count=0;
		long l=0;
		for(int i=0;i<=n/1234567;i++)
		{
			for(int j=0;j<=n/123456;j++)
			{
				l=(1234567*i)+(123456*j);
				if(n-l>=0)
				{
					if((n-l)%1234==0)
					{
						System.out.println("YES");
						count++;
						break;
					}
				}
			}
			if(count>0)
				break;
		}
		if(count==0)
			out.println("NO");
		out.close();
	}
	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream inputstream) {
			reader = new BufferedReader(new InputStreamReader(inputstream));
			tokenizer = null;
		}

		public String nextLine(){
			String fullLine=null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine=reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
}

import java.util.*;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		sc.close();

		int house = 1234567;
		int cars = 123456;
		int computer = 1234;

		int i = N/house;
		int j = N/cars;

		int rez = 0;
		for(int ii = 0 ; ii <= i; ii++){
			rez+=(ii*house);

			if(rez>N){
				break;
			}

			if(rez==N){
				System.out.println("YES");
				System.exit(0);
			}

			for(int jj = 0 ; jj <= j; jj++){
				rez+=(jj*cars);

				if(rez>N){
					break;
				}

				if(rez==N || (N-rez)%computer==0 ){
					System.out.println("YES");
					System.exit(0);
				}

				rez-=(jj*cars);
			}
			rez = 0;
		}

		System.out.println("NO");

	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author invisible
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        EconomyGame solver = new EconomyGame();
        solver.solve(1, in, out);
        out.close();
    }

    static class EconomyGame {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.readInt();
            for (int a = 0; a <= n / 1234567; a++) {
                for (int b = 0; b <= n / 123456; b++) {
                    int c = (n - a * 1234567 - b * 123456) % 1234 == 0 ? (n - a * 1234567 - b * 123456) / 1234 : -1;
                    //System.out.println(c);
                    if (c >= 0) {
                        //System.out.println(a*1234567+b*123456+c*1234);
                        out.printLine("YES");
                        return;
                    }
                }
            }
            out.printLine("NO");
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0)
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

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

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

        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

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

public class Solution
{
    public static void main(String args[]) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int  m=Integer.parseInt(br.readLine());
        int a=m/1234567;
        int b=m/123456;
        for(int i=0; i<=a; i++)
        {
            int n=m;
            n-=i*1234567;
            //System.out.println("outer n= "+n);
            for(int j=0; j<=b; j++)
            {
                int k=n;
                k-=j*123456;
                //System.out.println("inner n= "+n);
                if(k%1234 == 0 && k>=0)
                {
                    //System.out.println("very inner n= "+n);
                    System.out.println("YES");
                    return;
                }
            }
        }
        System.out.println("NO");
    }
}

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class BB
{

public static void main(String[] args)
{

    Scanner sc= new Scanner(System.in);

    int n=sc.nextInt();
    int a=1234567;
    int b=123456;
    int c=1234;

    int tot=n/a;

    for (int i = 0; i <= tot; i++) {
    int aa= i*a,bb,cc;

    int tot2=(n-aa)/b;

        for (int j = 0; j <= tot2; j++) {
            bb=b*j;

            int res=(n-aa-bb);

                if(res%c==0)
                {  System.out.println("YES");
                return;
                }

        }
    }

    System.out.println("NO");

}

}

import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		f681_a();
	  }

	public static void f681_a() {
		Scanner sc = new Scanner(System.in);
	    PrintWriter out = new PrintWriter(System.out);
	    boolean res = false;
	    long num = sc.nextInt();

	    for(long h=0; ; h++) {
	    	if(res || (h*1234567 > num))
	    		break;
	    	for(long car=0; ; car++) {
	    		if(res || ((car*123456 + h*1234567) > num) )
	    			break;
	    		long de = num - (car*123456 + h*1234567);
	    		if((de % 1234) == 0) {
	    			res = true;
    				out.println("YES");
	    		}
//	    		for(long comp=0; ; comp++){
//	    			if((car*123456 + h*1234567 + comp*1234) > num)
//		    			break;
//
//	    			if((car*123456 + h*1234567 + comp*1234) == num) {
//	    				res = true;
//	    				out.println("YES");
//	    				break;
//	    			}
//
//	    		}
	    	}
	    }

	    if(!res)
	    	out.println("NO");

	    out.close();
	    sc.close();
	}

	public static void test(){
		int a = Integer.valueOf("b0", 18);
		System.out.println(a);
	}

	public static void problem_333_a(){

	    Scanner sc = new Scanner(System.in);
	    PrintWriter out = new PrintWriter(System.out);
	    //BigInteger a, b, c;

	    //	l = sc.nextBigInteger();

	    int n, bx;
	    int m, by;

	    n = sc.nextInt(); bx = sc.nextInt();
	    BigInteger nler = new BigInteger("0");

	    BigInteger [] nn = new BigInteger[n];

	    int temp=0;
	    for(int i=0; i<n; i++) {
//	    	System.out.println(Math.pow(bx,(n-i-1)));
//	    	temp = sc.nextInt();
//	    	String b = "" +  temp*(Math.pow(bx,(n-i-1)));
//	    	b = b.substring(0, b.indexOf('.'));
//
//	    	nler = nler.add(new BigInteger(b));
	    	nn[i] = sc.nextBigInteger();
	    }

	    m = sc.nextInt(); by = sc.nextInt();
	    BigInteger mler = new BigInteger("0");
	    BigInteger [] mm = new BigInteger[m];
	    for(int i=0; i<m; i++) {
//	    	System.out.println(Math.pow(bx,(n-i-1)));
//	    	temp = sc.nextInt();
//	    	String a = temp*(Math.pow(by,(m-i-1))) + "";
//	    	a = a.substring(0, a.indexOf('.'));
//	    	mler = mler.add(new BigInteger(a));
	    	mm[i] = sc.nextBigInteger();
	    }
	    boolean equalFlag = false;
	    BigInteger nSelf = new BigInteger("0");
	    BigInteger nRadix = new BigInteger("1");

	    BigInteger mSelf = new BigInteger("0");
	    BigInteger mRadix = new BigInteger("1");

	    if(n>m && bx>by) {
	    	System.out.println(">");
	    	equalFlag = true;
	    } else if(n<m && bx<by) {
	    	System.out.println("<");
	    	equalFlag = true;
	    } else if(n==m && bx==by) {
	    	for(int i=0; i<n; i++){
	    		if(nn[i].equals(mm[i]))
	    			equalFlag = true;
	    		else {equalFlag = false; break;}
	    	}
	    	if(equalFlag) {
	    		System.out.println("<");

	    	}
	    }
	    if(!equalFlag) {
	    	for(int i=0; i<n; i++) {
    			nSelf = nSelf.add(nRadix.multiply(new BigInteger(nn[n-1-i] + "")));
    			nRadix = nRadix.multiply(new BigInteger(bx+""));
    		}

    		for(int i=0; i<m; i++) {
    			mSelf = mSelf.add(mRadix.multiply(new BigInteger(mm[m-1-i] + "")));
    			mRadix = mRadix.multiply(new BigInteger(by+""));
    		}
    		int res = nSelf.compareTo(mSelf);
    		if( res < 0)
    			System.out.println("<");
    		else if(res == 0) {
    			System.out.println("=");
    		}
    		else System.out.println(">");
	    }
	    //System.out.format("%.0f%n", mler);

//	    System.out.println(nler);
//	    System.out.println(mler);
	//
//	    if( nler.compareTo(mler) == 0) System.out.println("=");
//	    else if( nler.compareTo(mler) > 0) System.out.println(">");
//	    else if( nler.compareTo(mler) < 0) System.out.println("<");

	    out.println();

	    out.close();
	    sc.close();

	}

}

import java.util.Scanner;

public class Main {
	static Scanner si;

	public static void main(String[] args) {
		si = new Scanner(System.in);
		final int home= 1234567;
		final int car =123456;
		final int comp= 1234;
		final int hli =811;
		final  int cli= 8101;
		  int n,x;
		    n=si.nextInt();
		        for(int i=0;i<=hli;++i)
		        for(int j=0;j<=cli;++j){
		            x=n-(i*home+j*car);
		            if(x<0){
		                break;
		            }
		            if(x%comp==0){
		                System.out.println("YES");
		                  return ;
		            }
		        }

		        System.out.println("NO");
                return ;
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.*;

public class RR2 {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n= in.readInt();
            int hs = 1234567;
            int cr = 123456;
            int cp = 1234;
            //n = n - hs - cr - cp;
            //if (n == 0){System.out.println("YES");return;}
            //if (n < 0){System.out.println("NO");return;}
            for (int i = 0; i <= n/hs; i++)
            {
                for (int j = 0; j <= (n-i*hs)/cr; j++)
                {
                    if ((n-i*hs - j*cr)%cp == 0)
                    {
                        System.out.println("YES");
                        return;
                    }

                }
            }

            System.out.println("NO");

        }

    }

    static class IOUtils {
        public static int[] readIntArray(InputReader in, int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = in.readInt();
            }
            return array;
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void printLine(int i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

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

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

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

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

        public char readCharacter() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            return (char) c;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

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

public class Main {

    //---------------------------------------------------------------------------
    public static void main(String[] args) throws Exception {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        //-----------------------------------------------------------------------
        int n = in.nextInt();
        int[] a = {1234567, 123456, 1234};
        boolean ans = false;
        loop: for (int i = 0; i < 100; i++) {
            for (int j = 0; j < 1000; j++) {
                int x = n - (a[0] * i) - (a[1] * j);
                if (x == 0) {
                    ans = true;
                    break loop;
                }
                if (x > 0 && x % a[2] == 0) {
                    ans = true;
                    break loop;
                }
            }
        }
        if (ans) {
            out.println("YES");
        } else {
            out.println("NO");
        }
        //-----------------------------------------------------------------------
        out.close();
    }
    //---------------------------------------------------------------------------

    static class Pair implements Comparator {

        int first, second;

        public Pair() {

        }

        public Pair(int f, int s) {
            this.first = f;
            this.second = s;
        }

        @Override
        public int compare(Object o1, Object o2) {
            Pair p1 = (Pair) o1;
            Pair p2 = (Pair) o2;
            int ret = Integer.compare(p1.first, p2.first);
            if (ret == 0) {
                ret = Integer.compare(p1.second, p2.second);
            }
            return ret;
        }
    }

    static class InputReader {

        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

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

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

        public char[] nextCharArray() {
            return next().toCharArray();
        }

        public boolean hasNext() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    String s = reader.readLine();
                    if (s == null) {
                        return false;
                    }
                    tokenizer = new StringTokenizer(s);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return true;
        }

        public void skipLine() {
            try {
                tokenizer = null;
                reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}

import java.util.Arrays;
import java.util.Scanner;
import java.util.TreeMap;
import java.util.TreeSet;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.Map;
import java.util.PriorityQueue;

public class R357_2 {
	public static void main(String args[]){
		FasterScanner s=new FasterScanner();
		PrintWriter out = new PrintWriter(System.out);
    	int n=s.nextInt();
    	boolean bb= false;
    	long a=1234567;
    	long b=123456;
    	for(int i=0;i<1e9/b+1;i++){
    		long x=i*a;
    		long tmp=0;
    		for(;x+tmp<=n;){
    			int temp=n-(int)(x+tmp);
    			if(temp%1234==0)
    				bb=true;
    			tmp+=b;
    		}
    	}
    	if(bb)
    		out.println("YES");
    	else
    		out.println("NO");
		out.close();
	}
	public static class FasterScanner {
		private byte[] buf = new byte[1024];
		private int curChar;
		private int snumChars;
		public int read() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = System.in.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

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

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

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

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
	}
}

import java.util.Scanner;

/**
 * http://codeforces.com/contest/681/problem/B
 */
public class B {

	public static void main(String[] args) {
		new B().doJob();
	}

	private void doJob() {
		try (Scanner scanner = new Scanner(System.in)) {
			int c1 = 1234567;
			int c2 = 123456;
			double c3 = 1234;
			int n = scanner.nextInt();
			for (int a = 0; a <= n / c1; a++) {
				for (int b = 0; b <= (n - c1 * a) / c2; b++) {
					if (((n - a * c1 - b * c2) % c3 == 0 && (n - a * c1 - b * c2) / c3 >= 0)
							|| n - a * c1 - b * c2 == 0) {
						System.out.println("YES");
						return;
					}
				}
			}
			System.out.println("NO");
		}
	}
}

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

public class Main {
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer buffer;

    public static void solve() throws IOException {
        long n = ni();
        for (long a = 0; a*1234567<=n;a++) {
            for (long b=0;a*1234567 + b*123456<=n;b++) {
                if ((n - a*1234567 - b*123456)%1234 == 0) {
                    out.println("YES");
                    return;
                }
            }
        }
        out.println("NO");
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    static String next() {
        while (buffer == null || !buffer.hasMoreElements()) {
            try {
                buffer = new StringTokenizer(in.readLine());
            } catch (IOException e) {
            }
        }
        return buffer.nextToken();
    }

    static int ni() {
        return Integer.parseInt(next());
    }

    static long nl() {
        return Long.parseLong(next());
    }

    static double nd() {
        return Double.parseDouble(next());
    }

    static String ns() {
        return next();
    }

    static int[] ni(int n) {
        int[] res = new int[n];
        for (int i = 0; i < n; i++)
            res[i] = Integer.parseInt(next());
        return res;
    }

    static long[] nl(int n) {
        long[] res = new long[n];
        for (int i = 0; i < n; i++)
            res[i] = Long.parseLong(next());
        return res;
    }

    static double[] nd(int n) {
        double[] res = new double[n];
        for (int i = 0; i < n; i++)
            res[i] = Double.parseDouble(next());
        return res;
    }

    static String[] ns(int n) {
        String[] res = new String[n];
        for (int i = 0; i < n; i++)
            res[i] = next();
        return res;
    }

}

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

public class Main {

    public static void main(String[] args) throws IOException {
        Reader in = new Reader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));

        long n = in.nextInt();
        boolean flag = false;
        for (long a = 0; a * 1234567 <= n; a++) {
            for (long b = 0; b * 123456 + a * 1234567 <= n; b++) {
                long remain = n - b * 123456 - a * 1234567;
                if (remain % 1234 == 0) {
                    flag = true;
                    n = 0;
                    break;
                }
            }
        }

        out.println(flag ? "YES" : "NO");

        out.flush();
        in.close();
        out.close();
    }

    static class Reader {
        BufferedReader reader;
        StringTokenizer st;

        Reader(InputStreamReader stream) {
            reader = new BufferedReader(stream);
            st = null;
        }

        void close() throws IOException {
            reader.close();
        }

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

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

        String nextLine() throws IOException {
            return reader.readLine();
        }

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

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

    }
}

import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class cf1 {
    static long mod = (long)1e9 + 7;
    static long mod1 = 998244353;
    static FastScanner f;
    static PrintWriter pw = new PrintWriter(System.out);
    static Scanner S = new Scanner(System.in);
    static long x0; static long y0;
    static int inf = (int)(1e9);
    static long iinf = (long)(1e18);
    static void solve()throws NumberFormatException , IOException {
        int n = f.ni();
        for (int a = 0; a <= n / 1234567; ++a) {
            for (int b = 0; b <= n / 123456; ++b) {
                int c = (n - (1234567 * a) - (123456 * b));
                if (c % 1234 == 0 && a >= 0 && b >= 0 && c >= 0 && (a > 0 || b > 0 || c > 0)) {
                    pn("YES");
                    return;
                }
            }
        }
        pn("NO");
    }
    public static void main(String[] args)throws NumberFormatException , IOException {
        init();
        int t = 1;
        while(t --> 0) {solve();}
        pw.flush();
        pw.close();
    }

/******************************END OF MAIN PROGRAM*******************************************/
    public static void init()throws IOException{if(System.getProperty("ONLINE_JUDGE")==null){f=new FastScanner("");}else{f=new FastScanner(System.in);}}
    public static class FastScanner {
        BufferedReader br;StringTokenizer st;
        FastScanner(InputStream stream){try{br=new BufferedReader(new InputStreamReader(stream));}catch(Exception e){e.printStackTrace();}}
        FastScanner(String str){try{br=new BufferedReader(new FileReader("!a.txt"));}catch(Exception e){e.printStackTrace();}}
        String next(){while(st==null||!st.hasMoreTokens()){try{st=new StringTokenizer(br.readLine());}catch(IOException e){e.printStackTrace();}}return st.nextToken();}
        String nextLine()throws IOException{return br.readLine();}int ni(){return Integer.parseInt(next());}long nl(){return Long.parseLong(next());}double nd(){return Double.parseDouble(next());}
    }
    public static void pn(Object o){pw.println(o);}
    public static void p(Object o){pw.print(o);}
    public static void pni(Object o){pw.println(o);pw.flush();}
    static int gcd(int a,int b){if(b==0)return a;else{return gcd(b,a%b);}}
    static long gcd(long a,long b){if(b==0l)return a;else{return gcd(b,a%b);}}
    static long lcm(long a,long b){return (a*b/gcd(a,b));}
    static long exgcd(long a,long b){if(b==0){x0=1;y0=0;return a;}long temp=exgcd(b,a%b);long t=x0;x0=y0;y0=t-a/b*y0;return temp;}
    static long pow(long a,long b){long res=1;while(b>0){if((b&1)==1)res=res*a;b>>=1;a=a*a;}return res;}
    static long mpow(long a,long b){long res=1;while(b>0l){if((b&1)==1l)res=((res%mod)*(a%mod))%mod;b>>=1l;a=((a%mod)*(a%mod))%mod;}return res;}
    static long mul(long a , long b){return ((a%mod)*(b%mod)%mod);}
    static long adp(long a , long b){return ((a%mod)+(b%mod)%mod);}
    static int log2(int x){return (int)(Math.log(x)/Math.log(2));}
    static boolean isPrime(long n){if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(long i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}
    static boolean isPrime(int n){if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(int i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}
    static HashSet<Long> factors(long n){HashSet<Long> hs=new HashSet<Long>();for(long i=1;i<=(long)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n/i);}}return hs;}
    static HashSet<Integer> factors(int n){HashSet<Integer> hs=new HashSet<Integer>();for(int i=1;i<=(int)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n/i);}}return hs;}
    static HashSet<Long> pf(long n){HashSet<Long> ff=factors(n);HashSet<Long> ans=new HashSet<Long>();for(Long i:ff)if(isPrime(i))ans.add(i);return ans;}
    static HashSet<Integer> pf(int n){HashSet<Integer> ff=factors(n);HashSet<Integer> ans=new HashSet<Integer>();for(Integer i:ff)if(isPrime(i))ans.add(i);return ans;}
    static int[] inpint(int n){int arr[]=new int[n+1];for(int i=1;i<=n;++i){arr[i]=f.ni();}return arr;}
    static long[] inplong(int n){long arr[] = new long[n+1];for(int i=1;i<=n;++i){arr[i]=f.nl();}return arr;}
    static boolean ise(int x){return ((x&1)==0);}static boolean ise(long x){return ((x&1)==0);}
    static int gnv(char c){return Character.getNumericValue(c);}//No. of integers less than equal to i in ub
    static int log(long x){return x==1?0:(1+log(x/2));} static int log(int x){return x==1?0:(1+log(x/2));}
    static int upperbound(int a[],int i){int lo=0,hi=a.length-1,mid=0;int count=0;while(lo<=hi){mid=(lo+hi)/2;if(a[mid]<=i){count=mid+1;lo=mid+1;}else hi=mid-1;}return count;}
    static void sort(int[] a){ArrayList<Integer> l=new ArrayList<>();for(int i:a)l.add(i);Collections.sort(l);for(int i=0;i<a.length;++i)a[i]=l.get(i);}
    static void sort(long[] a){ArrayList<Long> l=new ArrayList<>();for(long i:a)l.add(i);Collections.sort(l);for(int i=0;i<a.length;++i)a[i]=l.get(i);}
    static void sort(ArrayList<Integer> a){Collections.sort(a);}//!Precompute fact in ncr()!
    static int nextPowerOf2(int n){int count=0;if(n>0&&(n&(n-1))==0)return n;while(n!=0){n>>=1;count += 1;}return 1<<count;}
}

import java.util.Scanner;

public class Problem681B {

	public static void main(String[] args) {
		Scanner scnr = new Scanner(System.in);

		int money = scnr.nextInt();
		scnr.close();

		System.out.println(func(money));

	}

	public static String func(int money)	{

		int maxA = money / 1234567;
		int maxB = money / 123456;

		for (int i = 0; i <= maxA; i++)	{
			for (int j = 0; j <= maxB; j++)	{
				int leftovers = money - (i * 1234567) - (j * 123456);

				if (leftovers >= 0 && leftovers % 1234 == 0)
					return "YES";
			}
		}

		return "NO";
	}

}

import java.util.*;
public class Main{
     public static void main(String ... string){
     Scanner sc = new Scanner(System.in);

     int n = sc.nextInt();
      for (int a = 0; a <= n; a += 1234567) {
        for (int b = 0; b <= n - a; b += 123456) {
            if ((n - a - b) % 1234 == 0) {
                System.out.println( "YES");
                return ;
            }
        }
    }
    System.out.println("NO");

  }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * User: olymp
 * Date: 13.09.15
 * Time: 11:00
 * To change this template use File | Settings | File Templates.
 */
public class Test {
    static BufferedReader in = null;
    static PrintWriter out = null;
    static StringTokenizer st = new StringTokenizer("");

    public static void main(String[] args) {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();

            out.close();
            in.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static String readString() {
        while (!st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(in.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    public static int readInt() {
        return Integer.parseInt(readString());
    }

    public static long readLong() {
        return Long.parseLong(readString());
    }

    public static double readDouble() {
        return Double.parseDouble(readString());
    }

    public static boolean isPalindrome(String s) {
        char[] x = s.toCharArray();
        for (int i = 0; i < s.length() / 2; i++) {
            if (x[i] != x[s.length() - 1 - i]) return false;
        }
        return true;
    }

    public static class Pair implements Comparable<Pair> {
        public int x, y;

        public Pair(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public int compareTo(Pair o) {
            if (Integer.compare(this.x, o.x) != 0) return Integer.compare(this.x, o.x);
            else return Integer.compare(this.y, o.y);
        }
    }

    public static boolean isPrime(int x) {
        boolean prime = true;
        for (int i = 2; i * i <= x; i++) {
            if (x % i == 0) {
                prime = false;
                break;
            }
        }
        return prime;
    }

    private static int countDivisors(int x) {
        int count = 1;
        for (int i = 2; i * i <= x; i++) {
            while (x % i == 0) {
                count++;
                x /= i;
            }
        }
        if (x != 1) count++;
        return count;
    }

    public static long hash(char[] a) {
        long ans = 0;
        long pow = 31;
        for (int i = 0; i < a.length; i++) {
            ans += pow * a[i];
            pow *= 31;
        }
        return ans;
    }

    private static long mod = 1_000_000_007;

    private static long binPow(long x, int step) {
        if (step == 0) return 1;
        if (step == 1) return x % mod;
        if (step % 2 == 0) {
            long temp = binPow(x, step / 2) % mod;
            return (temp * temp) % mod;
        }
        return (x * binPow(x, step - 1)) % mod;
    }

    static void solve() throws IOException {
        long n = readInt();
        for (long i = 0; 1234567 * i <= n; i++) {
            for (long j = 0; 123456 * j <= n - 1234567 * i; j++) {
                if ((n - 123456 * j - 1234567 * i) % 1234 == 0) {
                    System.out.println("YES");
                    return;
                }
            }
        }
        System.out.println("NO");
    }

}

import java.util.Scanner;

public class economyGame2 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan=new Scanner(System.in);
		int t=scan.nextInt();
		for(int c=0;c<=t/1234567;c++){
			for(int b=0;b<=t/123456;b++){
				int x=c*1234567+b*123456;
				if(x>t)break;
				if((t-x)%1234==0){
					System.out.println("YES");
					return;
				}
			}
		}
		System.out.println("NO");
	}

}

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

/**
 * Created by constanzafierro on 14-06-16.
 */
public class ProblemB {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        long houses = 1234567;
        long cars = 123456;
        long computers = 1234;
        for(int i = 0; i < 10000; i++){
            for(int j = 0; j < 1000; j++){
                if(n - i*houses - j*cars < 0) continue;
                if((n - i*houses - j*cars)%computers == 0){
                    System.out.println("YES");
                    return;
                }
            }
        }
        System.out.println("NO");
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.util.Scanner;

import javax.net.ssl.HostnameVerifier;

public class P681_B {

	private static StreamTokenizer inputReader = new StreamTokenizer(
			new BufferedReader(new InputStreamReader(System.in)));

	private static Scanner scaner = new Scanner(System.in);

	static java.io.BufferedReader reader = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));

	public static int nextInt() {
		int a = -1;
		try {
			inputReader.nextToken();
			a = (int) inputReader.nval;
		} catch (Exception e) {
		}
		return a;
	}

	public static void main(String[] args) {
		long n = scaner.nextLong();

		long compPrice = 1234;

		for (int i = 0; i <= 810; i++) {
			for (int j = 0; j <= 8100; j++) {
				long x = n - (123456 * j + 1234567 * i);
				if (x >= 0 && x % compPrice == 0) {
					System.out.println("YES");
					return;
				}
			}
		}

		System.out.println("NO");
	}

}

import java.util.Scanner;

public class test
{
    public static void main(String[] args)
    {
        Scanner cin=new Scanner(System.in);
        String ans="NO";
        long a,b,n;
        n=cin.nextLong();
        for(a=0;a<=n;a+=1234567)
        {
            for(b=0;b<=n-a;b+=123456)
            {
                if((n-a-b)%1234==0)
                {
                    ans="YES";
                }
            }
        }
        System.out.println(ans);
    }
}

import java.util.Scanner;

public class B {
    public static void main(String[] args) {
       	Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for (int a = 0; a <= n; a += 1234567) {
            for(int b=0; b <= n-a;b += 123456){
                if((n - a -b) % 1234 == 0){
                    System.out.println("YES");
                    return;
                }

            }
        }
        System.out.println("NO");
    }
}

import java.util.Scanner;

public class BBBB {

	public static void main(String args[])
	{
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		for(int i=0;i<20;i++)
		{
			for(int j=0;j<160;j++)
			{
				int lol=(i*1234567)+(j*123456);
				if(lol<=n) {
				int sum=n-((i*1234567)+(j*123456));
				if(sum%1234==0)
				{
					System.out.println("YES");
					return;
				}
				}
			}
		}
		System.out.println("NO");
	}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.LinkedList;

public class B {
	static class Node {
		int i, j, key;

		Node(int x, int y, int p) {
			i = x;
			j = y;
			key = p;
		}
	}

	static boolean inBounds(int i, int j, int n, int m) {
		return i >= 0 && i < n && j >= 0 && j < m;
	}

	public static void main(String[] args) throws Exception {
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		String l[] = bf.readLine().split(" ");
		int n = Integer.parseInt(l[0]);
		long a, b, c;
		long max = 1000000;
		if (n % 1234 == 0) {
			System.out.println("YES");
			return;
		}
		for (long i = 0; i <= 811; i++) {
			a = i * 1234567L;
			for (long j = 0; j <= 8101; j++) {
				b = j * 123456L;
				if (a + b > n)
					break;
				c = (n - a - b);
				if (a != 0 || b != 0 || c != 0)
					if (c % 1234 == 0 && (a + b + c) == n) {
						System.out.println("YES");
						return;
					}
			}
		}
		System.out.println("NO");
	}

}

//package com.codeforces.competitions.year2016.apriltojune.round357div2;

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

public final class TaskB
{
    public static void main(String[] args)
    {
        InputReader in = new InputReader(System.in);
        OutputWriter out = new OutputWriter(System.out);

		Solver solver = new Solver(in, out);
		solver.solve(1);

        out.flush();

        in.close();
        out.close();
    }

    static class Solver
    {
        int n;
        InputReader in;
        OutputWriter out;

        public Solver(InputReader in, OutputWriter out)
        {
        	this.in = in;
        	this.out = out;
        }

		void solve(int testNumber)
		{
			n = in.nextInt();

			long a, b, c;

			a = 1234567;
			b = 123456;
			c = 1234;

			for (long i = 0; i * c <= n; i++)
			{
				long temp1 = i * c;

				for (long j = 0; temp1 + j * b <= n; j++)
				{
					if ((n - temp1 - j * b) % a == 0)
					{
						out.println("YES");

						return;
					}

					/*long temp2 = j * b;

					for (long k = 0; temp1 + temp2 + k * a <= n; k++)
					{
						if (temp1 + temp2 + k * a == n)
						{
							out.println("YES");

							return;
						}
					}*/
				}
			}

			out.println("NO");
		}

	}

    static class InputReader
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

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

        public int read()
        {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars)
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                } catch (IOException e)
                {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt()
        {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

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

            int res = 0;

            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c & 15;

                c = read();
            } while (!isSpaceChar(c));

            return res * sgn;
        }

        public int[] nextIntArray(int arraySize)
        {
            int array[] = new int[arraySize];

            for (int i = 0; i < arraySize; i++)
                array[i] = nextInt();

            return array;
        }

        public long nextLong()
        {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sign = 1;

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

                c = read();
            }

            long result = 0;

            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                result *= 10;
                result += c & 15;

                c = read();
            } while (!isSpaceChar(c));

            return result * sign;
        }

        public long[] nextLongArray(int arraySize)
        {
            long array[] = new long[arraySize];

            for (int i = 0; i < arraySize; i++)
                array[i] = nextLong();

            return array;
        }

        public float nextFloat() // problematic
        {
            float result, div;
            byte c;

            result = 0;
            div = 1;
            c = (byte) read();

            while (c <= ' ')
                c = (byte) read();

            boolean isNegative = (c == '-');

            if (isNegative)
                c = (byte) read();

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

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

            if (isNegative)
                return -result;

            return result;
        }

        public double nextDouble() // not completely accurate
        {
            double ret = 0, div = 1;
            byte c = (byte) read();

            while (c <= ' ')
                c = (byte) read();

            boolean neg = (c == '-');

            if (neg)
                c = (byte) read();

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

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

            if (neg)
                return -ret;

            return ret;
        }

        public String next()
        {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do
            {
                res.appendCodePoint(c);

                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

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

        public String nextLine()
        {
            int c = read();

            StringBuilder result = new StringBuilder();

            do
            {
                result.appendCodePoint(c);

                c = read();
            } while (!isNewLine(c));

            return result.toString();
        }

        public boolean isNewLine(int c)
        {
            return c == '\n';
        }

        public void close()
        {
            try
            {
                stream.close();
            } catch (IOException e)
            {
                e.printStackTrace();
            }
        }

    }

    static class OutputWriter
    {
        private PrintWriter writer;

        public OutputWriter(OutputStream stream)
        {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
                    stream)));
        }

        public OutputWriter(Writer writer)
        {
            this.writer = new PrintWriter(writer);
        }

        public void println(int x)
        {
            writer.println(x);
        }

        public void print(int x)
        {
            writer.print(x);
        }

        public void println(int array[], int size)
        {
            for (int i = 0; i < size; i++)
                println(array[i]);
        }

        public void print(int array[], int size)
        {
            for (int i = 0; i < size; i++)
                print(array[i] + " ");
        }

        public void println(long x)
        {
            writer.println(x);
        }

        public void print(long x)
        {
            writer.print(x);
        }

        public void println(long array[], int size)
        {
            for (int i = 0; i < size; i++)
                println(array[i]);
        }

        public void print(long array[], int size)
        {
            for (int i = 0; i < size; i++)
                print(array[i]);
        }

        public void println(float num)
        {
            writer.println(num);
        }

        public void print(float num)
        {
            writer.print(num);
        }

        public void println(double num)
        {
            writer.println(num);
        }

        public void print(double num)
        {
            writer.print(num);
        }

        public void println(String s)
        {
            writer.println(s);
        }

        public void print(String s)
        {
            writer.print(s);
        }

        public void println()
        {
            writer.println();
        }

        public void printSpace()
        {
            writer.print(" ");
        }

        public void flush()
        {
            writer.flush();
        }

        public void close()
        {
            writer.close();
        }

    }

	static class CMath
	{
		static long power(long number, long power)
		{
			if (number == 1 || number == 0 || power == 0)
				return 1;

			if (power == 1)
				return number;

			if (power % 2 == 0)
				return power(number * number, power / 2);
			else
				return power(number * number, power / 2) * number;
		}

		static long modPower(long number, long power, long mod)
		{
			if (number == 1 || number == 0 || power == 0)
				return 1;

			number = mod(number, mod);

			if (power == 1)
				return number;

			long square = mod(number * number, mod);

			if (power % 2 == 0)
				return modPower(square, power / 2, mod);
			else
				return mod(modPower(square, power / 2, mod) * number, mod);
		}

		static long moduloInverse(long number, long mod)
		{
			return modPower(number, mod - 2, mod);
		}

		static long mod(long number, long mod)
		{
			return number - (number / mod) * mod;
		}

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

	}

}

import com.sun.org.apache.xpath.internal.operations.Bool;

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

public class Main {
    public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
    private static long aLong;

    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

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

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

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

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

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

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

    public static  int A = 1234567;
    public static  int B = 123456;
    public static  int C = 1234;
    // public static  int[] ws = new int[] {0,s,m,b};

static String insert = "insert";
static String removeMin = "removeMin";

static String getMin = "getMin";

    public static void main(String[] args) {

        MyScanner scanner = new MyScanner();
        int n = scanner.nextInt();
//
//        PriorityQueue<Integer> heap = new PriorityQueue<>();
//
//        List<String> commands = new ArrayList<>();
//
//        for (int index = 0; index < n;  ++index ) {
//            String command = scanner.next();
//
//            if (command.equals(insert)) {
//                int num = scanner.nextInt();
//                heap.add(num);
//                commands.add(command + " " + num);
//            }
//            else if (command.equals(removeMin)) {
//                if (heap.isEmpty()) {
//                    heap.add(1);
//                    commands.add(insert + " " + 1);
//
//                }
//                heap.poll();
//                commands.add(command);
//            }
//            else if (command.equals(getMin)) {
//                int num = scanner.nextInt();
//                if (heap.isEmpty()) {
//                    heap.add(num);
//                    commands.add(insert + " " + num);
//                    heap.poll();
//                    commands.add(command + " " + num);
//                }
//                else {
//                    if (heap.peek() == num) {
//                        heap.poll();
//                        commands.add(command + " " + num);
//                    }
//                    else {
//                        while (!heap.isEmpty() && heap.peek() < num) {
//                            commands.add(removeMin);
//                            heap.poll();
//                        }
//                        if (heap.isEmpty()) {
//                            heap.add(num);
//                            commands.add(insert + " " + num);
//                            heap.poll();
//                            commands.add(command + " " + num);
//                        }
//                        else
//                        {
//                            if (heap.peek() == num) {
//                                heap.poll();
//                                commands.add(command + " " + num);
//                            }
//                            else {
//                                heap.add(num);
//                                commands.add(insert + " " + num);
//                                heap.poll();
//                                commands.add(command + " " + num);
//                            }
//
//                        }
//                    }
//                }
//            }
//        }
//
//        out.println(commands.size());
//        for (String comm : commands) {
//            out.println(comm);
//        }

//        int d[][] = new int[4][n + 1];
//        d[0][0] = 0;
//        for (int c = 1; c <= n; ++c) {
//            d[0][c] = 0;
//        }
//        for (int type = 1; type <= 3; ++type) {
//            for (int c = 0; c <= n; ++c) {
//                if (c <= ws[type] - 1) {
//                    d[type][c] = d[type - 1][c];
//                }
//                else
//                {
//                    d[type][c] = Math.max(d[type - 1][c], d[type][c - ws[type]] + ws[type]);
//                }
//            }
//        }
//
//
//
//        long l = d[3][n];

//        int d[] = new int[n + 1];
//
//        for (int type = 1; type <= 3; ++type) {
//            for (int c = 0; c <= n; ++c) {
//                if (c <= ws[type] - 1) {
//                    d[c] = d[c];
//                }
//                else
//                {
//                    d[c] = Math.max(d[c], d[c - ws[type]] + ws[type]);
//                }
//            }
//        }
//        long l = d[n];

        for (int a = 0; a <= n/A; ++a) {
            for (int b = 0; b <= (n - a * A) / B; ++b)
            {
                int cC = n - a * A - b*B;
                if (cC % C == 0) {
                    out.println("YES");
                    out.close();
                    return;
                }
            }
        }

        out.println("NO");
        out.close();
    }

//    private static HashMap<Long, Boolean> _cache = new HashMap<>();
//
//    private static boolean calc(long n) {
//        // return calc()
//        if (n<0) return false;
//        if (n==0) return true;
//        if (!_cache.containsKey(n)) {
//            boolean res = calc(n - b) || calc(n - m) || calc(n - s);
//            _cache.put(n, res);
//            return res;
//        }
//        return _cache.get(n);
//    }
}

import java.io.*;
public class EconomyGame {
    static BufferedReader br;
    static int n;
    public static void main(String[] args) {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            init();
            System.out.println(solve());
            br.close();
        }
        catch(Exception e) {
            e.printStackTrace();
        }
    }
    private static void init() throws IOException {
    	n = Integer.parseInt(br.readLine());
    }
    private static String solve() {
        for(int i = 0; i <= n; i += 1234567) {
        	for(int j = 0; i + j <= n; j += 123456) {
        		if((n - i - j) % 1234 == 0) {
        			return "YES";
        		}
        	}
        }
        return "NO";
    }
}

import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n=sc.nextInt(),n1,n2,temp;

		n1 = n/1234567;
		temp = n%1234567;

		boolean check = false;

		for(int i=0;i<=n1 && !check;i++)
		{
			int m = temp + i*(1234567);

			int m1,m2;
			m1 = m/123456;
			m2 = m%123456;

			for(int j=0;j<=m1 && !check;j++)
			{
				int nm = (m2 + j*123456);

				if(nm%1234==0)
					check = true;
			}
		}

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

		sc.close();
	}

}

import java.util.Scanner;

public class cop {

	public static void main(String[] args) {

		Scanner	sc = new Scanner (System.in);
			long n = sc.nextLong();

			long a=1234567;
			long b=123456;
			long c=1234;
			long p=0;
	int h=0;boolean f= true;
			for(int k=0 ;k<1000 && f ;k++){
				for (int j=0;j<10000 && f;j++){

			p=n-(a*k+b*j);
			if (p%c==0 && p>=0){
							        System.out.println("YES");
							        h++;
							        f=false;

				}}

			}if(h==0)
				System.out.println("NO");

			}

}

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

public class EconomyGame {

	public static void main(String[] args) throws IOException{
		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(reader.readLine());
		for(int a=0;a<=n;a+=1234567)
		{
			for(int b=0;b<=n-a;b+=123456)
			{
				if((n-a-b)%1234==0){
					System.out.println("YES");
					return;
				}
			}
		}
		System.out.println("NO");
	}
}

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

public class Main{

   public static void main(String[] args) {
      MyScanner sc = new MyScanner();
      out = new PrintWriter(new BufferedOutputStream(System.out));

      // Start writing your solution here. -------------------------------------

      /*
      int n      = sc.nextInt();        // read input as integer
      long k     = sc.nextLong();       // read input as long
      double d   = sc.nextDouble();     // read input as double
      String str = sc.next();           // read input as String
      String s   = sc.nextLine();       // read whole line as String

      int result = 3*n;
      out.println(result);                    // print via PrintWriter
      */

      Solver.solve(sc,out);

      out.close();
   }
   public static class Solver{
       public static void solve(MyScanner sc,PrintWriter out){
         int n = sc.nextInt();
         int house =1234567;
         int car = 123456;
         int computer = 1234;
         boolean ans = false;
         for(int a=0;a<=n/house;a++){
           for(int b=0;b<=n/car;b++){

             if((n-(a*house)-(b*car))>=0 &&(n-(a*house)-(b*car)) % computer ==0 ){
               ans= true;
               break;
             }
           }
         }
         out.println(ans == true ? "YES" : "NO");

	    }

	}

   //-----------PrintWriter for faster output---------------------------------
   public static PrintWriter out;

   //-----------MyScanner class for faster input----------
   public static class MyScanner {
      BufferedReader br;
      StringTokenizer st;

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

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

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

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

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

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

   }
   //--------------------------------------------------------
}

import java.util.HashSet;
import java.util.Scanner;

public class Main {
    static HashSet<Integer> memoizacija;

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        int res1 = 0;

        if(N == 0){
            System.out.println("YES");
            System.exit(0);
        }

        for(int i = 0; i<810; i++){
            int res2 = 0;
            for(int j = 0; j<8101; j++){
                int res = N - res1 - res2;
                if(res >= 0 && res%1234 == 0){
                    System.out.println("YES");
                    System.exit(0);
                }
                res2 += 123456;
            }
            res1 += 1234567;
        }

        System.out.println("NO");
    }
}

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

public class ProblemB{
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		while(n >= 1234567){
			n -= 1234567;
		}
		while(n >= 123456){
			n -= 123456;
		}
		while(n >= 1234){
			n -= 1234;
		}
		if(n == 0){
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}

import java.util.Scanner;
public class main {
	public static void main(String args[]){
	Scanner s=new Scanner(System.in);
	int a=s.nextInt();
	int c=0;
	for(int i=0;i<1000;i++){

		if(i*1234567>a) break;
		if(a/1234567==0){	System.out.println("yes");c=1; return;}
		for(int j=0;j<10000;j++){
			int t=a-i*1234567;
			if(	t/123456==0){	System.out.println("yes");c=1; return;}
			if(i*1234567+j*123456>a) break;
				int y=a-i*1234567+j*123456;
				if(y/1234==0) {	System.out.println("yes");c=1; return;}

			}
		}

if(c==0) System.out.println("no");
}}

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

/* Name of the class has to be "Main" only if the class is public. */
public class Compilation {

    public static void main(String[] args) throws java.lang.Exception {
        // your code goes here
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String arr[];

        int n = Integer.parseInt(br.readLine());

        boolean found = false;
        out:
        for (int a = 1234567; (long) a <= n; a += 1234567) {
            if (a > n) {
                break;
            }
            for (int b = 123456; (long) b <= n; b += 123456) {
                if (a + b > n) {
                    break out;
                }
                for (int c = 1234; c <= n; c += 1234) {
                    if ((long) a + b + c > n) {
                        break out;
                    }
                    if (b + a + c == n) {
                        found = true;
                        break out;
                    }

                }
            }
        }

        System.out.println(found ? "YES" : "NO");
    }
}

import java.util.*;
public class EG {
    public static void main(String args[]) {
    Scanner in = new Scanner(System.in) ;
    int n=in.nextInt();int a=0,b=0,c=0;
    while(a<=n) {
        while(b<=n-a) {
            if(((n-(a+b))%1234)==0) {
                c=1 ;
            }
        b=b+123456;
        }
        a=a+1234567;
    }
    System.out.println(c==1?"YES":"NO");
    }
}

import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n=sc.nextInt(),n1,n2;

		n1 = n2 = n;

		n = n%1234567;

		n = n%123456;

		if((n%1234)==0)
			System.out.println("YES");
		else
		{
			n1 = n1%123456;

			if((n1%1234)==0)
				System.out.println("YES");
			else
			{
				if((n2%1234)==0)
					System.out.println("YES");
				else
					System.out.println("NO");
			}
		}

		sc.close();
	}

}

import java.util.Scanner;

public class bhhh {
	public static void main(String[] args) {
		Scanner sc = new Scanner (System.in);
		int n = sc.nextInt();

		int d=0;

		for(int a=1;a<100;a++){
			for(int b=1;b<100;b++){
				for(int c=1;c<100;c++){
					if (a*1234567+b*123456+c*1234==n){
						System.out.println("YES");d++;
						break;}

					}
				}
			}
		if(d==0)
			System.out.println("NO");}
}

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class BB
{

public static void main(String[] args)
{

    Scanner sc= new Scanner(System.in);

    int n=sc.nextInt();
    int a=1234567;
    int b=123456;
    int c=1234;

    int tot=n/a;

    for (int i = 1; i <= tot; i++) {
    int aa= i*a,bb,cc;
    int r=n%aa;
    int tot2=(n-aa+r)/b;

        for (int j = 1; j <= tot2; j++) {
            bb=b*j;

            int res=(n-aa-bb);

                if(res%c==0&&res>=c)
                {  System.out.println("YES");
                return;
                }

        }
    }

    System.out.println("NO");

}

}

import java.util.*;
public class EconomyGame{
  public static void main(String args[]){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    if((((n%1234567)%123456)%1234)==0)
      System.out.println("YES");
    else if(((n%123456)%1234)==0)
      System.out.println("YES");
    else if((n%1234)==0)
      System.out.println("YES");
    else System.out.println("NO");

  }

}

import java.util.Scanner;

public class ConsoleApplication {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        String ans = "NO";
        boolean done = false;
        int a = 1234567;
        int b = 123456;
        int c = 1234;

        for (int i = 1; !done; i++) {
            if ((a * i) + (b * i) + (c * i) == n) {
                ans = "YES";
                done = true;
            } else if ((a * i) + (b) + (c) == n) {
                ans = "YES";
                done = true;
            } else if ((a) + (b * i) + (c) == n) {
                ans = "YES";
                done = true;
            } else if ((a) + (b) + (c * i) == n) {
                ans = "YES";
                done = true;
            } else if ((a) + (b) + (c * i) > n) {
                done = true;
            }
        }

        System.out.println(ans);

    }//End main funciton.

}//End ConsoleApplication Class.

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;

import java.lang.management.MemoryType;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.security.cert.CollectionCertStoreParameters;
import java.util.*;
import java.util.function.Function;

public class Main {

        public static void main (String[]args) throws IOException {
        Scanner in = new Scanner(System.in);
        try(PrintWriter or = new PrintWriter(System.out)) {
            int n = in.nextInt();
            int A=1234567;
            int B=123456;
            int c=1234;
            for (int a = 0; a*A <=n ; a++) {
                for (int b = 0;a*A +b*B <= n; b++) {
                    int ss= n-a*A +b*B;
                    if (ss%c==0){
                        or.println("YES");
                        return;
                    }
                }
            }
            or.println("NO");

        }
    }

    static int getlen(int r,int l,int a){
        return (r-l+1+1)/(a+1);
    }

    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
            return st.nextToken();
        }

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

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++) {
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec) {
                        f *= 10;
                    }
                }
            }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    }
}

class Pair  {
    int first, second;

    public Pair(int first, int second) {
        this.first = first;
        this.second = second;
    }

}

class Tempo {

    int num;
    int index;

    public Tempo(int num, int index) {
        this.num = num;
        this.index = index;
    }
}

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		long n=sc.nextLong();
		boolean flag=false;
		long c=0;
		long limit1=n/1234567;
		long limit2=n/123456;
		for(int i=0;i<=limit1;i++)
		{
			for(int j=0;j<=limit2;j++)
			{
				c=n-(i*1234567)-(j*123456);
				if(c%1234==0){
					flag=true;
					break;
				}
			}
			if(flag)
				break;
		}
		if(flag) System.out.println("YES");
		else System.out.println("NO");

	}

}

import java.util.Scanner;

public class C357B {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String[] s = sc.nextLine().trim().split(" ");
	}

}

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

public class B {
    public static void solution(BufferedReader reader, PrintWriter out)
            throws IOException {
        In in = new In(reader);
        long n = in.nextLong();
        boolean found = false;
        for (int a = 1, r1 = 1234567; r1 < n; a++, r1 += 1234567)
            for (int b = 1, r2 = 123456; r1 + r2 < n; b++, r2 += 123456)
                if ((n - r1 - r2) % 1234 == 0)
                    found = true;
        out.println(found ? "YES" : "NO");
    }

    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(
                new BufferedWriter(new OutputStreamWriter(System.out)));
        solution(reader, out);
        out.close();
    }

    protected static class In {
        private BufferedReader reader;
        private StringTokenizer tokenizer = new StringTokenizer("");

        public In(BufferedReader reader) {
            this.reader = reader;
        }

        public String next() throws IOException {
            while (!tokenizer.hasMoreTokens())
                tokenizer = new StringTokenizer(reader.readLine());
            return tokenizer.nextToken();
        }

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

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

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

import java.io.*;
import java.util.*;
import java.io.IOException;
import java.io.InputStream;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collector;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) {

        File file = new File("in.txt");
        InputStream inputStream = null;
//        try {inputStream= new FileInputStream(file);} catch (FileNotFoundException ex){return;};
        inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskB {

     private Map<Integer,Boolean> cache;
     public void solve(int testNumber, InputReader in, PrintWriter out) {
         Integer n = in.nextInt();
         for (int a = 0; a <= n; a += 1234567) {
             for (int b = 0; n - a + b <= n; b += 123456) {
                 if (n >(a+b) && ((n - a - b) % 1234) == 0) {
                     out.println("YES");
                     return;
                 }
             }
         }
         out.println("NO");
         return;
     }

}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

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

    public String nextLine(){
        try {
            return reader.readLine();
        } catch (IOException e){
            throw new RuntimeException(e);
        }
    }

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

}

class Pair<F, S> {
    public final F first;
    public final S second;

    public Pair(F first, S second) {
        this.first = first;
        this.second = second;
    }

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof Pair)) {
            return false;
        }
        Pair<?, ?> p = (Pair<?, ?>) o;
        return Objects.equals(p.first, first) && Objects.equals(p.second, second);
    }

    @Override
    public int hashCode() {
        return (first == null ? 0 : first.hashCode()) ^ (second == null ? 0 : second.hashCode());
    }

    @Override
    public String toString() {
        return "(" + first + ", " + second + ')';
    }
}

import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class cf1 {
    static long mod = (long)1e9 + 7;
    static long mod1 = 998244353;
    static FastScanner f;
    static PrintWriter pw = new PrintWriter(System.out);
    static Scanner S = new Scanner(System.in);
    static long x0; static long y0;
    static int inf = (int)(1e9);
    static long iinf = (long)(1e18);
    static void solve()throws NumberFormatException , IOException {
        int n = f.ni();
        for (int a = 0; a <= n / 1234567; ++a) {
            for (int b = 0; b <= n / 123456; ++b) {
                int temp = (n - (1234567 * a) - (123456 * b));
                if ((a > 0 || b > 0 || temp > 0) && temp % 1234 == 0) {
                    pn("YES");
                    return;
                }
            }
        }
        pn("NO");
    }
    public static void main(String[] args)throws NumberFormatException , IOException {
        init();
        int t = 1;
        while(t --> 0) {solve();}
        pw.flush();
        pw.close();
    }

/******************************END OF MAIN PROGRAM*******************************************/
    public static void init()throws IOException{if(System.getProperty("ONLINE_JUDGE")==null){f=new FastScanner("");}else{f=new FastScanner(System.in);}}
    public static class FastScanner {
        BufferedReader br;StringTokenizer st;
        FastScanner(InputStream stream){try{br=new BufferedReader(new InputStreamReader(stream));}catch(Exception e){e.printStackTrace();}}
        FastScanner(String str){try{br=new BufferedReader(new FileReader("!a.txt"));}catch(Exception e){e.printStackTrace();}}
        String next(){while(st==null||!st.hasMoreTokens()){try{st=new StringTokenizer(br.readLine());}catch(IOException e){e.printStackTrace();}}return st.nextToken();}
        String nextLine()throws IOException{return br.readLine();}int ni(){return Integer.parseInt(next());}long nl(){return Long.parseLong(next());}double nd(){return Double.parseDouble(next());}
    }
    public static void pn(Object o){pw.println(o);}
    public static void p(Object o){pw.print(o);}
    public static void pni(Object o){pw.println(o);pw.flush();}
    static int gcd(int a,int b){if(b==0)return a;else{return gcd(b,a%b);}}
    static long gcd(long a,long b){if(b==0l)return a;else{return gcd(b,a%b);}}
    static long lcm(long a,long b){return (a*b/gcd(a,b));}
    static long exgcd(long a,long b){if(b==0){x0=1;y0=0;return a;}long temp=exgcd(b,a%b);long t=x0;x0=y0;y0=t-a/b*y0;return temp;}
    static long pow(long a,long b){long res=1;while(b>0){if((b&1)==1)res=res*a;b>>=1;a=a*a;}return res;}
    static long mpow(long a,long b){long res=1;while(b>0l){if((b&1)==1l)res=((res%mod)*(a%mod))%mod;b>>=1l;a=((a%mod)*(a%mod))%mod;}return res;}
    static long mul(long a , long b){return ((a%mod)*(b%mod)%mod);}
    static long adp(long a , long b){return ((a%mod)+(b%mod)%mod);}
    static int log2(int x){return (int)(Math.log(x)/Math.log(2));}
    static boolean isPrime(long n){if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(long i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}
    static boolean isPrime(int n){if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(int i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}
    static HashSet<Long> factors(long n){HashSet<Long> hs=new HashSet<Long>();for(long i=1;i<=(long)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n/i);}}return hs;}
    static HashSet<Integer> factors(int n){HashSet<Integer> hs=new HashSet<Integer>();for(int i=1;i<=(int)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n/i);}}return hs;}
    static HashSet<Long> pf(long n){HashSet<Long> ff=factors(n);HashSet<Long> ans=new HashSet<Long>();for(Long i:ff)if(isPrime(i))ans.add(i);return ans;}
    static HashSet<Integer> pf(int n){HashSet<Integer> ff=factors(n);HashSet<Integer> ans=new HashSet<Integer>();for(Integer i:ff)if(isPrime(i))ans.add(i);return ans;}
    static int[] inpint(int n){int arr[]=new int[n+1];for(int i=1;i<=n;++i){arr[i]=f.ni();}return arr;}
    static long[] inplong(int n){long arr[] = new long[n+1];for(int i=1;i<=n;++i){arr[i]=f.nl();}return arr;}
    static boolean ise(int x){return ((x&1)==0);}static boolean ise(long x){return ((x&1)==0);}
    static int gnv(char c){return Character.getNumericValue(c);}//No. of integers less than equal to i in ub
    static int log(long x){return x==1?0:(1+log(x/2));} static int log(int x){return x==1?0:(1+log(x/2));}
    static int upperbound(int a[],int i){int lo=0,hi=a.length-1,mid=0;int count=0;while(lo<=hi){mid=(lo+hi)/2;if(a[mid]<=i){count=mid+1;lo=mid+1;}else hi=mid-1;}return count;}
    static void sort(int[] a){ArrayList<Integer> l=new ArrayList<>();for(int i:a)l.add(i);Collections.sort(l);for(int i=0;i<a.length;++i)a[i]=l.get(i);}
    static void sort(long[] a){ArrayList<Long> l=new ArrayList<>();for(long i:a)l.add(i);Collections.sort(l);for(int i=0;i<a.length;++i)a[i]=l.get(i);}
    static void sort(ArrayList<Integer> a){Collections.sort(a);}//!Precompute fact in ncr()!
    static int nextPowerOf2(int n){int count=0;if(n>0&&(n&(n-1))==0)return n;while(n!=0){n>>=1;count += 1;}return 1<<count;}
}

import java.util.Scanner;

public class BBBB {

	public static void main(String args[])
	{
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		if(((n%1234567)%123456)%1234==0) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
	}
}

import java.util.*;
public class susbus{
   public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      boolean asdf = false;
      for (int i=0;i<=(int) n/123456;i++){
         for (int j=0;j<=(int) n/1234567;j++){
            int k = (n-123456*i-1234567*j)/1234;
            if (1234*k+123456*i+123457*j==n) {
               asdf = true;
               break;
            }
         }
      }
      if(asdf) System.out.println("YES");
      else System.out.println("NO");
   }
}

import java.util.Scanner;

public class economyGame2 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan=new Scanner(System.in);
		int t=scan.nextInt();
		for(int c=0;c<=t/123456;c++){
			for(int b=0;b<=t/1234567;b++){
				int x=c*123456+b*1234567;
				System.out.println(x);
				if(x>t)break;
				if((t-x)%1234==0){
					System.out.println("YES");
					return;
				}
			}
		}
		System.out.println("NO");
	}

}

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

public class Main {
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer buffer;

    public static void solve() throws IOException {
        long n = ni();
        for (long a = 0; a*1234567<=n;a++) {
            for (long b=0;a*1234567 + b*123456<=n;b++) {
                if ((n - a*1235467 - b*123456)%1234 == 0) {
                    out.println("YES");
                    return;
                }
            }
        }
        out.println("NO");
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    static String next() {
        while (buffer == null || !buffer.hasMoreElements()) {
            try {
                buffer = new StringTokenizer(in.readLine());
            } catch (IOException e) {
            }
        }
        return buffer.nextToken();
    }

    static int ni() {
        return Integer.parseInt(next());
    }

    static long nl() {
        return Long.parseLong(next());
    }

    static double nd() {
        return Double.parseDouble(next());
    }

    static String ns() {
        return next();
    }

    static int[] ni(int n) {
        int[] res = new int[n];
        for (int i = 0; i < n; i++)
            res[i] = Integer.parseInt(next());
        return res;
    }

    static long[] nl(int n) {
        long[] res = new long[n];
        for (int i = 0; i < n; i++)
            res[i] = Long.parseLong(next());
        return res;
    }

    static double[] nd(int n) {
        double[] res = new double[n];
        for (int i = 0; i < n; i++)
            res[i] = Double.parseDouble(next());
        return res;
    }

    static String[] ns(int n) {
        String[] res = new String[n];
        for (int i = 0; i < n; i++)
            res[i] = next();
        return res;
    }

}

import java.util.Scanner;

public class BBBB {

	public static void main(String args[])
	{
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		for(int i=0;i<15;i++)
		{
			for(int j=0;j<140;j++)
			{
				int lol=(i*1234567)+(j*123456);
				if(lol<n) {
				int sum=n-((i*1234567)+(j*123456));
				if(sum%1234==0)
				{
					System.out.println("YES");
					return;
				}
				}
			}
		}
		System.out.println("NO");
	}
}

//package tc_str;

import java.util.Scanner;

public class Main {

	private static final int HOUSE_COST = 1234567;
	private static final int CAR_COST = 123456;
	private static final int COMP_COST = 1234;

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		int sum;

		try (final Scanner scanner = new Scanner(System.in);) {
			sum = scanner.nextInt();

			if (sum > 0) {
				if (checkHouses(sum))
					System.out.println("YES");
				else
					System.out.println("NO");
			} else
				throw new IllegalArgumentException("Sum = " + sum);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private static boolean checkHouses(int sum) {

		if (sum % HOUSE_COST == 0)
			return true;
		else {
			if (sum >= HOUSE_COST) {
				for (int i = sum / HOUSE_COST; i > 0; i--) {
					if (checkCars(sum - i * HOUSE_COST))
						return true;
				}
				return false;
			} else {
				return checkCars(sum);
			}
		}
	}

	private static boolean checkCars(int sum) {

		if (sum % CAR_COST == 0)
			return true;
		else {
			if (sum >= CAR_COST) {
				for (int i = sum / CAR_COST; i > 0; i--) {
					if (checkComps(sum - i * CAR_COST))
						return true;
				}
				return false;
			} else {
				return checkComps(sum);
			}
		}
	}

	private static boolean checkComps(int sum) {

		if (sum % COMP_COST == 0)
			return true;
		else
			return false;
	}
}

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

public class E252109 {

    public static void pri_result(int i) {
        System.out.println(i);
        System.exit(0);
    }

    public static void SolveA() {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        if (k %2 == 0 && k !=2 ) {
            System.out.println("YES");
        }
        else
            System.out.println("NO");
        System.exit(0);
    }

    public static void SolveB() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int total = 0;
        for (int i=0; i< n; i++) {
            int local = 0;
            for (int j=0; j< 3; j++) {
                local += sc.nextInt();
            }
            if (local >=2)
                total ++;
        }
        System.out.println(total);
        System.exit(0);
    }

    public static void SolveC() {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int l = sc.nextInt();
        int m= sc.nextInt();
        int n = sc.nextInt();
        int d = sc.nextInt();
        int total = 0;
        for (int i=1; i<=d; i++) {
            if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)
                total ++;
        }
        System.out.println(total);
        System.exit(0);
    }

    public static void Solve681B() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        final int A = 1234567;
        final int B = 123456;
        final int C = 1234;
        boolean found = false;

        int an = n / A;
        if (an * A == n)
            an --;

        for (int i = 1; !found && i<= an ; i++) {
            int n2 = n - i * A;
            int bn = n2 / B;
            if (bn * B == n2)
                bn --;
            for (int i2 = 1; !found && i2 <= bn; i2++) {
                int n3 = n2 - i2 * B;
                if (n3 % C == 0)
                    found = true;
            }
        }

        if (found)
            System.out.println("YES");
        else
            System.out.println("NO");
        System.exit(0);
    }

    public static void main(String args[]) {
        // SolveA();
        // SolveB();
        // SolveC();
        Solve681B();
    }
}

import java.util.*;

public class Test1 {
    public static void main(String at[]){
    	Scanner scan=new Scanner(System.in);
    	int n=scan.nextInt();
    	boolean flag=true;
    	int a=1234567,b=123456;
    	loop :for(int i=0;i<=1000;i++){
    		for(int j=0;j<n-10000;j++){
    			int r=n-a*i-b*j;
    			if(r%1234==0){
    				System.out.println("YES");
    				flag=false;
    				break loop;
    			}
    		}
    	}
    	if(flag)
    		System.out.println("NO");

    }
}

import java.util.Scanner;

public class B {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long maxA = n / 1234567;
        for (long a = 0; a <= maxA; a++) {
            if (a * 1234657 <= n) {
                long n1 = n - a * 1234567;
                long maxB = n1 / 123456;
                for (long b = 0; b <= maxB; b++) {
                    if (b * 123456 <= n1) {
                        long n2 = n1 - b * 123456;
                        if (n2 % 1234 == 0) {
                            System.out.println("YES");
                            return;
                        }
                    }
                }
            }
        }
        System.out.println("NO");
    }
}

import java.util.*;
public class Main{
     public static void main(String ... string){
          Scanner sc = new Scanner(System.in);
          int n = sc.nextInt();
          for(int i = 0; i<= n/1234567; i++){
               for(int j =0; j<= n/123456; j++){
                    if((n - (i*1234567 - j*123456))/1234 >= 0){
                         System.out.println("YES");
                         return;
                    }
               }
          }
          System.out.println("NO");
     }
}

import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n=sc.nextInt(),n1,n2;

		n1 = n2 = n;

		n = n%1234567;

		n = n%123456;

		if((n%1234)==0)
			System.out.println("YES");
		else
		{
			n1 = n1%123456;

			if((n1%1234)==0)
				System.out.println("YES");
			else
			{
				if((n2%1234)==0)
					System.out.println("YES");
				else
					System.out.println("NO");
			}
		}

		sc.close();
	}

}

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

public class EconomyGame {

	static boolean valid(long l, HashMap<Long,Boolean> mem) {
		if (mem.containsKey(l)) {
			return mem.get(l);
		}
		else if (l % 1234 == 0) {
			return true;
		}
		else if (l < 0) {
			return false;
		}
		else {
			boolean result = valid(l - 123456, mem) || valid(l - 1234567, mem);
			mem.put(l, result);
			return result;
		}
	}

	public static void main(String[] args) {
		HashMap<Long, Boolean> mem = new HashMap<Long, Boolean>();
		Scanner reader = new Scanner(System.in);
		long coins = Long.parseLong(reader.nextLine());

		if (valid(coins, mem)) {
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}
		reader.close();
	}

}

import java.util.Scanner;

public class bhhh {

	public static void main(String[] args) {

		Scanner	sc = new Scanner (System.in);
			int n = sc.nextInt();

			int a=1234567;
			int b=123456;
			int c=1234;
			int p=0;
	int h=0;boolean f= true;
			for(int k=0 ;k<1000 && f ;k++){
				for (int j=0;j<10000 && f;j++){

						if (n>=k*a+j*b){

						p=n-a*k+b*j;
						    if (p%c==0){
							        System.out.println("YES");
							        h++;
							        f=false;

				}}

				}

			}if(h==0)
				System.out.println("NO");

			}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class R {

	public static void main(String args[]) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));

		Scanner sc = new Scanner(System.in);

		long n = Long.parseLong(br.readLine());

		long x1 = n / 1234567;
		long x2 = n / 123456;

		for (long i = 0; i <= x1; i++)
			for (long j = 0; j <= x2; j++) {

				long val = i * 1234567 * 1l + j * 123456 * 1l;
				long temp = n - val;

				if (temp < 0) {
					System.out.println("NO");
					return;
				}

				long p = temp % 1234;

				if (p == 0) {
					System.out.println("YES");
					return;
				}
			}

		System.out.println("NO");

	}
}

//package tc_str;

import java.util.Scanner;

public class Main {

	private static final int HOUSE_COST = 1234567;
	private static final int CAR_COST = 123456;
	private static final int COMP_COST = 1234;

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		int sum;

		try (final Scanner scanner = new Scanner(System.in);) {
			sum = scanner.nextInt();

			if (sum > 0) {
				if (checkHouses(sum))
					System.out.println("YES");
				else
					System.out.println("NO");
			} else
				throw new IllegalArgumentException("Sum = " + sum);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private static boolean checkHouses(int sum) {

		if (sum % HOUSE_COST == 0)
			return true;
		else {

			for (int i = sum / HOUSE_COST; i > 0; i--) {
				if (checkCars(sum - i * HOUSE_COST))
					return true;
			}
			return false;
		}
	}

	private static boolean checkCars(int sum) {

		if (sum % CAR_COST == 0)
			return true;
		else {
			for (int i = sum / CAR_COST; i > 0; i--) {
				if (checkComps(sum - i * CAR_COST))
					return true;
			}
			return false;
		}
	}

	private static boolean checkComps(int sum) {

		if (sum % COMP_COST == 0)
			return true;
		else
			return false;
	}
}

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

public class EconomyGame {

	static boolean valid(long l, HashMap<Long,Boolean> mem) {
		if (mem.containsKey(l)) {
			return mem.get(l);
		}
		else if (l % 1234 == 0 || l % 123456 == 0 || l % 1234567 == 0) {
			return true;
		}
		else if (l < 0) {
			return false;
		}
		else {
			boolean result = valid(l - 123456, mem) || valid(l - 1234567, mem);
			mem.put(l, result);
			return result;
		}
	}

	public static void main(String[] args) {
		HashMap<Long, Boolean> mem = new HashMap<Long, Boolean>();
		Scanner reader = new Scanner(System.in);
		long coins = Long.parseLong(reader.nextLine());

		if (valid(coins, mem)) {
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}
	}

}

import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n=sc.nextInt(),n1,n2,temp;

		n1 = n/1234567;
		temp = n%1234567;

		boolean check = false;

		for(int i=0;i<=n1 && !check;i++)
		{
			int m = temp + i*n1;

			int m1,m2;
			m1 = m/123456;
			m2 = m%123456;

			for(int j=0;j<=m1 && !check;j++)
			{
				int nm = (m2 + m1*j);

				if(nm%1234==0)
					check = true;
			}
		}

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

		sc.close();
	}

}

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

public class B {
    public static void solution(BufferedReader reader, PrintWriter out)
            throws IOException {
        In in = new In(reader);
        long n = in.nextLong();
        boolean found = false;
        for (int r1 = 0; r1 < n; r1 += 1234567)
            for (int r2 = 0; r1 + r2 < n; r2 += 123456)
                if ((n - r1 - r2) % 1234 == 0)
                    found = true;
        out.println(found ? "YES" : "NO");
    }

    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(
                new BufferedWriter(new OutputStreamWriter(System.out)));
        solution(reader, out);
        out.close();
    }

    protected static class In {
        private BufferedReader reader;
        private StringTokenizer tokenizer = new StringTokenizer("");

        public In(BufferedReader reader) {
            this.reader = reader;
        }

        public String next() throws IOException {
            while (!tokenizer.hasMoreTokens())
                tokenizer = new StringTokenizer(reader.readLine());
            return tokenizer.nextToken();
        }

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

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

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

import java.util.*;
public class Main{
     public static void main(String ... string){
     Scanner sc = new Scanner(System.in);
     int n = sc.nextInt();
     for(int a = 0; a <= n/1234567; a++) {
          for(int b = 0; b <= n/123456; b++) {
               if((n - a*1234567 - b*123456) / 1234 >= 0) {
                   System.out.println( "YES");
                   return ;
               }
          }
     }
        System.out.println("NO");
  }
}

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

/**
 * Created by rishabh on 14/6/16.
 */
public class _357B {
    public static void main(String[] args) throws IOException{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(in.readLine());
        long n = Long.parseLong(st.nextToken());

        boolean flag = true;
        for (int i = 0; i < n / 1234567; i++) {
            for (int j = 0; j < n / 123456; j++) {
                if ((n - 1234567 * i - 123456 * j) % 1234 == 0 && (n - 1234567 * i - 123456 * j) >= 0) {
//                    System.out.println("n = " + n + " i = " + i + " j = " + j + "  " +
//                            ((n - 1234567 * i - 123456 * j) * 1234 + 123456 * j + 1234567 * i));
                    System.out.println("YES");
                    flag = false;
                }
            }
        }
        if (flag) {
            if (n % 1234 == 0 || n % 123456 == 0 || n % 1234567 == 0) System.out.println("YES");
            else System.out.println("NO");
        }
    }
}

import java.util.Scanner;

public class main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int house = 1234567;
		int car = 123456;
		int computer = 1234;
		int maxHouse = n/house;
		int maxCar = n/car;
		int maxComputer = n/computer;
		for (int i = 0; i <= maxHouse; i++) {
			for (int j = 0; j <= (n - i * house)/car; j++) {
				int left = n - i * house - j * car;
				if (left % computer == 0) {
					System.out.println("car = " + j + " house = " + i);
					System.out.println("YES");
					return;
				}
			}
		}
		System.out.println("NO");
	}
}

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

public class Main {
    //---------------------------------------------------------------------------

    public static void main(String[] args) throws Exception {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        //-----------------------------------------------------------------------
        int n = in.nextInt();
        int a = 1234567;
        int b = 123456;
        int c = 1234;
        int bc = 76172352;
        int ac = 1523455678;
        boolean ans = false;
        if (n % a == 0) {
            ans = true;
        }
        if (n % b == 0) {
            ans = true;
        }
        if (n % c == 0) {
            ans = true;
        }
        if (n % (a + b) == 0) {
            ans = true;
        }
        if (n % (a + c) == 0) {
            ans = true;
        }
        if (n % (b + c) == 0) {
            ans = true;
        }
        if (n % (a + b + c) == 0) {
            ans = true;
        }
        if (ans) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
        //-----------------------------------------------------------------------
        out.close();
    }
    //---------------------------------------------------------------------------

    static class Pair implements Comparator {

        int first, second;

        public Pair() {

        }

        public Pair(int f, int s) {
            this.first = f;
            this.second = s;
        }

        @Override
        public int compare(Object o1, Object o2) {
            Pair p1 = (Pair) o1;
            Pair p2 = (Pair) o2;
            int ret = Integer.compare(p1.first, p2.first);
            if (ret == 0) {
                ret = Integer.compare(p1.second, p2.second);
            }
            return ret;
        }
    }

    static class InputReader {

        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

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

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

        public char[] nextCharArray() {
            return next().toCharArray();
        }

        public boolean hasNext() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    String s = reader.readLine();
                    if (s == null) {
                        return false;
                    }
                    tokenizer = new StringTokenizer(s);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return true;
        }

        public void skipLine() {
            try {
                tokenizer = null;
                reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}

import java.io.*;

public class B681
{
	public static void main(String[] ar) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		long n = Long.parseLong(br.readLine());
		long HOUSE_COST=1234567;
		long CAR_COST=123456;
		long COMPUTER_COST=1234;

		long maxHouses = n / HOUSE_COST;
		long maxCars = n / CAR_COST;
		long maxComputers = n / COMPUTER_COST;

		boolean found = false;

		for(long i=0; i<=maxHouses; i++)
		{
			for(long j=0; j<=maxCars; j++)
			{
				long remainderSpend = n - (i*HOUSE_COST + j*CAR_COST);
				if(remainderSpend > 0 && remainderSpend % COMPUTER_COST == 0)
				{
					found = true;
					break;
				}
			}
			if(found)
				break;
		}

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

import java.util.Scanner;

public class BBBB {

	public static void main(String args[])
	{
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		for(int i=1;i<15;i++)
		{
			for(int j=1;j<140;j++)
			{
				int lol=(i*1234567)+(j*123456);
				if(lol<n && lol>=1234) {
				int sum=n-((i*1234567)+(j*123456));
				if(sum%1234==0)
				{
					System.out.println("YES");
					return;
				}
				}
			}
		}
		System.out.println("NO");
	}
}

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

public class Main {
    //---------------------------------------------------------------------------

    public static void main(String[] args) throws Exception {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        //-----------------------------------------------------------------------
        int n = in.nextInt();
        int a = 1234567;
        int b = 123456;
        int c = 1234;
        boolean ans = false;
        if (n % a == 0) {
            ans = true;
        }
        if (n % b == 0) {
            ans = true;
        }
        if (n % c == 0) {
            ans = true;
        }
        if (n % (a + b) == 0) {
            ans = true;
        }
        if (n % (a + c) == 0) {
            ans = true;
        }
        if (n % (b + c) == 0) {
            ans = true;
        }
        if (n % (a + b + c) == 0) {
            ans = true;
        }
        if (ans) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
        //-----------------------------------------------------------------------
        out.close();
    }
    //---------------------------------------------------------------------------

    static class Pair implements Comparator {

        int first, second;

        public Pair() {

        }

        public Pair(int f, int s) {
            this.first = f;
            this.second = s;
        }

        @Override
        public int compare(Object o1, Object o2) {
            Pair p1 = (Pair) o1;
            Pair p2 = (Pair) o2;
            int ret = Integer.compare(p1.first, p2.first);
            if (ret == 0) {
                ret = Integer.compare(p1.second, p2.second);
            }
            return ret;
        }
    }

    static class InputReader {

        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

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

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

        public char[] nextCharArray() {
            return next().toCharArray();
        }

        public boolean hasNext() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    String s = reader.readLine();
                    if (s == null) {
                        return false;
                    }
                    tokenizer = new StringTokenizer(s);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return true;
        }

        public void skipLine() {
            try {
                tokenizer = null;
                reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}

import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.*;
import java.util.Scanner;

public class DSU {

    final int MAX = (int) (10e5 + 2);
    int[] parent = new int[MAX];
    int[] rank = new int[MAX];
    int[] total = new int[MAX];

    public DSU(int n) {

        for (int i = 0; i < MAX; i++) {
            parent[i] = i;
        }
    }

    int FindLeader(int node) {
        return (parent[node] == node) ? node : (parent[node] = FindLeader(parent[node]));
    }

    boolean SameSet(int i, int k) {
        return FindLeader(i) == FindLeader(k);
    }

    void MergeGroup(int i, int k) {
        int px = FindLeader(i);
        int py = FindLeader(k);
        if(py==px)return;
            if (rank[px] <= rank[py]) {
                parent[py] = px;
                rank[py]=rank[px];
            } else {
                parent[px] = py;
               rank[px]=rank[py];
            }

    }

    int GetSize(int node) {
        int leader = FindLeader(node);
        return rank[leader];
    }

    public static void main(String[] args) throws IOException {
        Scanner in = new Scanner(System.in);
        try (PrintWriter or = new PrintWriter(System.out)) {
            long n=in.nextLong();
            for (int i = 1; i <=100; ++i) {
                for (int j = 1; j <= 100; ++j) {
                    for (int k = 1; k <= 100; ++k) {
                       long ans=(long) i*1234567+(long)j*123456+(long)k*1234;
                        if(ans==n){
                            or.print("YES");return;
                        }
                    }
                }
            }
            or.print("NO");
        }

    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class R {

	public static void main(String args[]) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));

		Scanner sc = new Scanner(System.in);

		long n = Long.parseLong(br.readLine());

		long x1 = n / 1234567;
		long x2 = n / 123456;

		for (long i = 0; i <= x1; i++)
			for (long j = 0; j <= x2; j++) {

				long val = i * 1234567 * 1l + j * 123456 * 1l;
				long temp = n - val;

				if (temp == 0) {
					System.out.println("NO");
					return;
				}

				long p = temp % 1234;

				if (p == 0) {
					System.out.println("YES");
					return;
				}
			}

		System.out.println("NO");

	}
}

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

public class B {

    void solve() {
        int n = in.nextInt();
        int a = 1234567;
        int b = 123456;
        int c = 1234;
        while (n/a > 0){
            n %= a;
        }
        while (n/b > 0){
            n %= b;
        }
        while (n/c > 0){
            n %= c;
        }
        if (n == 0){
            out.println("YES");
        } else {
            out.println("NO");
        }
    }

    FastScanner in;
    PrintWriter out;

    void run() {
        try {
            in = new FastScanner(new File("B.in"));
            out = new PrintWriter(new File("B.out"));

            solve();

            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    void runIO() {

        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

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

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

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

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

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

    public static void main(String[] args) {
        new B().runIO();
    }
}

import java.util.*;
public class EconomingGame
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int ct = 0;
int l = 1;
while(true)
{
      if(((l*1234567)+(l*123456)+(l*1234))==n)
      {
            System.out.println("YES");
            return;
      }
      else if(((l*1234567)+(l*123456)+(l*1234))< n)
      {
            l++;
      }
      else if(((l*1234567)+(l*123456)+(l*1234)) > n)
      {
            System.out.println("NO");
            return;
      }
}
}
}

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

/**
 * Created by constanzafierro on 14-06-16.
 */
public class ProblemB {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int houses = 1234567;
        int cars = 123456;
        int computers = 1234;
        for(int i = 0; i < 10000; i++){
            for(int j = 0; j < 1000; j++){
                if((n - i*houses + j*cars)%computers == 0){
                    System.out.println("YES");
                    return;
                }
            }
        }
        System.out.println("NO");
    }
}

import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n=sc.nextInt(),n1,n2,temp;

		n1 = n/1234567;
		temp = n%1234567;

		boolean check = false;

		for(int i=0;i<=n1 && !check;i++)
		{
			int m = temp + i*n1;

			int m1,m2;
			m1 = m/123456;
			m2 = m%123456;

			for(int j=0;j<=m && !check;j++)
			{
				int nm = (m2 + m1*j);

				if(nm%1234==0)
					check = true;
			}
		}

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

		sc.close();
	}

}

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

public class NewClass {

    static final int INF = Integer.MAX_VALUE;

    static void mergeSort(int[] a, int p, int r) {
        if (p < r) {
            int q = (p + r) / 2;
            mergeSort(a, p, q);
            mergeSort(a, q + 1, r);
            merge(a, p, q, r);
        }
    }

    static void merge(int[] a, int p, int q, int r) {
        int n1 = q - p + 1;
        int n2 = r - q;
        int[] L = new int[n1 + 1], R = new int[n2 + 1];

        for (int i = 0; i < n1; i++) {
            L[i] = a[p + i];
        }
        for (int i = 0; i < n2; i++) {
            R[i] = a[q + 1 + i];
        }
        L[n1] = R[n2] = INF;

        for (int k = p, i = 0, j = 0; k <= r; k++) {
            if (L[i] <= R[j]) {
                a[k] = L[i++];
            } else {
                a[k] = R[j++];
            }
        }
    }

    public static boolean sieve(int n) {
        int a[] = new int[n + 1];
        for (int i = 2; i <= n; i++) {
            a[i] = 1;
        }
        for (int i = 2; i <= Math.sqrt(n); i++) {
            if (a[i] == 1) {
                for (int k = 2; i * k <= n; k++) {
                    a[i * k] = 0;
                }
            }
        }
        return a[n] == 1;
    }
public static long sum(int a){
    long su=0;
    while (a>0) {
        su+=a%10;
        a/=10;
    }
    return su;
}
    public static boolean prime(int n) {
        for (int i = 2; i <= Math.sqrt(n); i++) {
            if (n%i==0) {
                return true;
            }
        }
        return false;
    }

    public static String reve(int a, int b, String s) {
        String q = "";
        for (int i = b; i >= a; i--) {
            q += s.charAt(i);
        }
        return q;
    }
    public static boolean isvowel(char c){
        if (c=='a' ||c=='e'||c=='i'||c=='o'||c=='u'||c=='y') {
            return true;
        }
        else return false;
    }
    public static void main(String[] args) throws IOException {
        InputReader in = new InputReader(System.in);
        OutputWriter or = new OutputWriter(System.out);
        long n = in.nextLong();
        while (true) {
            if (n%1234567==0 ||n%123456==0||n%1234==0) {
                or.print("YES");
                or.flush();
                return;
            }
            if (n>=1234567) {
                n-=1234567;
            }
            else if (n>=123456&&n<1234567) {
                n-=123456;
            }
            else if (n>=1234 &&n<1234567) {
                n-=1234;
            }
            else break;
        }
        or.print(n==0?"YES":"NO");
        or.flush();
    }
}

class InputReader {

    private final InputStream stream;
    private final byte[] buf = new byte[8192];
    private int curChar, snumChars;

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

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

    public int nextInt() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long nextLong() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

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

    public String readString() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public String nextLine() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isEndOfLine(c));
        return res.toString();
    }

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

    private boolean isEndOfLine(int c) {
        return c == '\n' || c == '\r' || c == -1;
    }

}

class OutputWriter {

    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0) {
                writer.print(' ');
            }
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }

    public void flush() {
        writer.flush();
    }

}

import java.util.Scanner;

public class economyGame2 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan=new Scanner(System.in);
		int t=scan.nextInt();
		for(int c=0;c<=t/123456;c++){
			for(int b=0;b<=t/1234567;b++){
				int x=c*123456+b*1234567;
				System.out.println(x);
				if(x>t)break;
				if((t-x)%1234==0){
					System.out.println("YES");
					return;
				}
			}
		}
		System.out.println("NO");
	}

}

import java.util.Scanner;

public class B {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long maxA = n / 1234567;
        for (long a = 0; a <= maxA; a++) {
            if (a * 1234657 <= n) {
                long n1 = n - a * 1234567;
                long maxB = n1 / 123456;
                for (long b = 0; b <= maxB; b++) {
                    if (b * 123456 <= n1) {
                        long n2 = n1 - b * 123456;
                        if (n2 % 1234 == 0) {
                            System.out.println("YES");
                            return;
                        }
                    }
                }
            }
        }
        System.out.println("NO");
    }
}

import java.util.Scanner;

public class cop {

	public static void main(String[] args) {

		Scanner	sc = new Scanner (System.in);
			int n = sc.nextInt();

			int a=1234567;
			int b=123456;
			int c=1234;
			int p=0;
	int h=0;boolean f= true;
			for(int k=0 ;k<1000 && f ;k++){
				for (int j=0;j<10000 && f;j++){

						if (n>=k*a+j*b){

						p=n-a*k+b*j;
						    if (p%c==0){
							        System.out.println("YES");
							        h++;
							        f=false;

				}}

				}

			}if(h==0)
				System.out.println("NO");

			}

}

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

public class E252109 {

    public static void pri_result(int i) {
        System.out.println(i);
        System.exit(0);
    }

    public static void SolveA() {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        if (k %2 == 0 && k !=2 ) {
            System.out.println("YES");
        }
        else
            System.out.println("NO");
        System.exit(0);
    }

    public static void SolveB() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int total = 0;
        for (int i=0; i< n; i++) {
            int local = 0;
            for (int j=0; j< 3; j++) {
                local += sc.nextInt();
            }
            if (local >=2)
                total ++;
        }
        System.out.println(total);
        System.exit(0);
    }

    public static void SolveC() {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int l = sc.nextInt();
        int m= sc.nextInt();
        int n = sc.nextInt();
        int d = sc.nextInt();
        int total = 0;
        for (int i=1; i<=d; i++) {
            if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)
                total ++;
        }
        System.out.println(total);
        System.exit(0);
    }

    public static void Solve681B() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        final int A = 1234567;
        final int B = 123456;
        final int C = 1234;
        boolean found = false;

        int an = n / A;
        if (an * A == n)
            found = true;

        for (int i = 1; !found && i<= an ; i++) {
            int n2 = n - i * A;
            int bn = n2 / B;
            if (bn * B == n2)
                found = true;
            for (int i2 = 1; !found && i2 <= bn; i2++) {
                int n3 = n2 - i2 * B;
                if (n3 % C == 0)
                    found = true;
            }
        }

        if (found)
            System.out.println("YES");
        else
            System.out.println("NO");
        System.exit(0);
    }

    public static void main(String args[]) {
        // SolveA();
        // SolveB();
        // SolveC();
        Solve681B();
    }
}

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

public class B {
	public static int n;
	public static void main(String[] args) throws IOException {
		BufferedReader in= new BufferedReader(new InputStreamReader (System.in));
		long n= Long.parseLong(in.readLine());
		long a= n/1234567;
		long b= n/123456;
		boolean done= false;
		for (int i = 1; i <= a; i++) {
			for (int j = 1; j <= b; j++) {
				long temp= i*1234567+j*123456;
				temp= n-temp;
				if(temp>=0&&temp%1234==0){
					System.out.println(temp);
					done= true;
				}
			}
		}
		if(done){
			System.out.println("YES");
		}
		else{
			System.out.println("NO");
		}

	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class R {

	public static void main(String args[]) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));

		Scanner sc = new Scanner(System.in);

		long n = Long.parseLong(br.readLine());

		long x1 = n / 1234567;
		long x2 = n / 123456;

		for (long i = 1; i <= x1; i++)
			for (long j = 1; j <= x2; j++) {

				long val = i * 1234567 * 1l + j * 123456 * 1l;
				n -= val;

				if (n <= 0) {
					System.out.println("NO");
					return;
				}

				long p = n % 1234;

				if (p == 0) {
					System.out.println("YES");
					return;
				}
			}

		System.out.println("NO");
	}
}

import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

	void solve(Scanner in, PrintWriter out) {
		int h = 1234567;
		int c = 123456;
		int p = 1234;
		int i1 = 0, j1 = 0, g1 = 0, s = 0;
		int n = in.nextInt();
		for (int i = 1; i < n; i++) {
			if (h * i > n) {
				i1 = i - 1;
				break;
			} else if (h * i == n) {
				out.println("YES");
				s = 1;
				break;
			}
		}
		for (int j = 1; j < n; j++) {
			if ((h * i1) + (c * j) > n) {
				j1 = j - 1;
				break;
			}
			if ((h * i1) + (c * j) == n && s != 1) {
				out.println("YES");
				s = 1;
				break;
			}
		}
		for (int g = 1; g < n; g++) {
			if ((h * i1) + (c * j1) + (p * g) > n) {
				break;
			}
			if ((h * i1) + (c * j1) + (p * g) == n && s != 1) {
				out.println("YES");
				s = 1;
				break;
			}
		}
		if (s == 0)
			out.println("NO");
	}

	void run() {
		try (Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out)) {
			solve(in, out);
		}
	}

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

import java.util.Scanner;

public class problem {

	public static void main (String[] args){

		Scanner input = new Scanner (System.in);

		int n = input.nextInt();
		int a = 1234567;
		int b = 123456;
		int c = 1234;

		boolean isBug = true;

		n = n%a;
		if (n==0){
			isBug=false;
		}
		else {
			n=n%b;
			if (n==0){
				isBug = false;
			}
			else {
				n=n%c;
				if (n==0){
					isBug=false;
				}
			}
		}
		if (!isBug){
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}

	}
}

import java.util.*;
public class Main{
     public static void main(String ... string){
          Scanner sc = new Scanner(System.in);
          int n = sc.nextInt();
          for(int i = 0; i<= n/1234567; i++){
               for(int j =0; j<= n/123456; j++){
                    if((n - (i*1234567 - j*123456))/1234 >= 0){
                         System.out.println("YES");
                         return;
                    }
               }
          }
          System.out.println("NO");
     }
}

import java.util.*;
public class susbus{
   public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      boolean asdf = false;
      for (int i=0;i<=n/1234567;i++){
         for (int j=0;j<=n/123456;j++){
            int k = (n-1234567*i-123456*j);
            if (1234*k+1234567*i+123456*j==n) {
               asdf = true;
            }
         }
      }
      if(asdf) System.out.println("YES");
      else System.out.println("NO");
   }
}

import java.util.*;
import java.io.*;
//558A
public class TestClass{
	public static void main(String[] args) throws Exception{

		InputReader sc = new InputReader(System.in);
		PrintWriter wr = new PrintWriter(System.out);
		int n=sc.nextInt();
		int h=1234567;
		int cr=123456;
		int cmp=1234;
		//if(n%h==0){
			n-=(n/h)*h;
		//}
		//if(n%cr==0){
			n-=(n/cr)*cr;
	//	}
		//if(n%cmp==0){
			n-=(n/cmp)*cmp;
	//	}
		if(n==0) System.out.println("YES");
		else System.out.println("NO");
	}
	public static int GCD(int value1, int value2)
    {
        while (value1 != 0 && value2 != 0)
        {
            if (value1 > value2)
                value1 %= value2;
            else
                value2 %= value1;
        }
        return Math.max(value1, value2);
    }
	public static long power(long a,long b)
	{
	    long ans=1;
	    while(b>0)
	    {
	        if(b%2==1)
	        {
	            ans*=a;
	            ans=ans%1000000007;
	        }
	        a*=a;
	        a=a%1000000007;
	        b/=2;
	    }
	    return ans%1000000007;
	}
}
class InputReader{
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

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

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

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

	public int nextInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public long nextLong() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String nextToken() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public String nextLine() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isEndOfLine(c));
		return res.toString();
	}

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

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

	public void pArray(int[] arr){
		for (int i=0; i<arr.length; i++) {
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	public void pArray(long[] arr){
		for (int i=0; i<arr.length; i++) {
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}

	private boolean isEndOfLine(int c) {
		return c == '\n' || c == '\r' || c == -1;
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}

}

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

public class jam{
   public static void main(String[] args) {
      MyScanner sc = new MyScanner();
      out = new PrintWriter(new BufferedOutputStream(System.out));

      // Start writing your solution here. -------------------------------------
      int n = sc.nextInt();
      boolean flag = false;
      for (int i =n/1234567;i>0 && !flag;i--){
    	  for (int j=n/123456;j>0 && !flag;j--){
    		  for (int m=n/1234;m>0 && !flag;m--){
    			  if(n-(i*1234567+j*123456+m*1234)==0){
    				  flag=true;
    				  break;
    			  }
    			  if((n-(i*1234567+j*123456))%1234!=0) break;
    		  }
    	  }
      }
      if(flag) out.println("YES");
      else out.println("NO");
      // Stop writing your solution here. -------------------------------------
      out.close();
   }

   //-----------PrintWriter for faster output---------------------------------
   public static PrintWriter out;

   //-----------MyScanner class for faster input----------
   public static class MyScanner {
      BufferedReader br;
      StringTokenizer st;

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

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

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

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

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

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

   }
   //--------------------------------------------------------
}

import java.util.Scanner;

public class main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int house = 1234567;
		int car = 123456;
		int computer = 1234;
		int maxHouse = n/house;
		int maxCar = n/car;
		int maxComputer = n/computer;
		for (int i = 0; i <= maxHouse; i++) {
			for (int j = 0; j < maxCar; j++) {
				int left = n - i * house - j * car;
				if (left % computer == 0) {
					System.out.println("YES");
					return;
				}
			}
		}
		System.out.println("NO");
	}
}

import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for (int i = 0; i <= n; i += 1234567) {
            for (int j = 0; j < n - i; j += 123456) {
                if ((n - i - j) % 1234 == 0) {
                    System.out.println("YES");
                    return;
                }
            }
        }
        System.out.println("NO");
        return;
    }
}

import java.util.Scanner;

public class bhhh {

	public static void main(String[] args) {

		Scanner	sc = new Scanner (System.in);
			int n = sc.nextInt();

			int a=1234567;
			int b=123456;
			int c=1234;
			int p=0;
	int h=0;boolean f= true;
			for(int k=0 ;k<1000 && f ;k++){
				for (int j=0;j<10000 && f;j++){

						if (n>=k*a+j*b){

						p=n-a*k+b*j;
						    if (p%c==0){
							        System.out.println("YES");
							        h++;
							        f=false;

				}}

				}

			}if(h==0)
				System.out.println("NO");

			}

}

import java.util.Scanner;

public class BBBB {

	public static void main(String args[])
	{
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		for(int i=0;i<15;i++)
		{
			for(int j=0;j<140;j++)
			{
				int lol=(i*1234567)+(j*123456);
				if(lol<=n) {
				int sum=n-((i*1234567)+(j*123456));
				if(sum%1234==0)
				{
					System.out.println("YES");
					return;
				}
				}
			}
		}
		System.out.println("NO");
	}
}

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

/**
 * Created by rishabh on 14/6/16.
 */
public class _357B {
    public static void main(String[] args) throws IOException{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(in.readLine());
        long n = Long.parseLong(st.nextToken());

        boolean flag = true;
        for (int i = 0; i < 1000; i++) {
            for (int j = 0; j < 10000; j++) {
                if ((n - 1234567 * i - 123456 * j) % 1234 == 0 && (n - 1234567 * i - 123456 * j) >= 0) {
//                    System.out.println("n = " + n + " i = " + i + " j = " + j + "  " +
//                            ((n - 1234567 * i - 123456 * j) * 1234 + 123456 * j + 1234567 * i));
                    System.out.println("YES");
                    flag = false;
                }
            }
        }
        if (flag) {
            if (n % 1234 == 0 || n % 123456 == 0 || n % 1234567 == 0) System.out.println("YES");
            else System.out.println("NO");
        }
    }
}

import java.util.*;
import java.math.*;
public class Udhan272 {
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int n=scan.nextInt();
      //  if(n<=1234567){
      //   System.out.println("NO");
      //  }else{

         int a=n/1234567;
         boolean u1=false;
         k:
         for(int x=a;x>=1;x--){
           int b=n-(x*1234567);
           int c=b/123456;
           for(int y=c;y>=1;y--){
            int d=b-(y*123456);
            int e=d/1234;
            for(int z=e;z>=1;z--){
             int f=d-(1234*z);
             if(f==0){
              u1=true;
              break k;
             }
            }
           }
         }
         if(u1==true){
          System.out.println("YES");
         }else{
          System.out.println("NO");
         }
      //  }
    }
}

import java.util.*;
import java.io.*;
import java.math.*;
public class Mahdi{
    public static void main(String[] args) throws Exception{
     BufferedReader in =new BufferedReader(new InputStreamReader(System.in));

     int n=Integer.parseInt(in.readLine());int a=1234567;int b=123456;int c=1234;
    for(int i= 1;i<=1000;i++)
        for(int j= 1;j<=1000;j++)
            if((i*a+j*b)<=1000000000)
                if((n-(i*a+j*b))%c==0&&(n-(i*a+j*b))>=0){
                    System.out.println("YES");
                    System.exit(0);
                }
        System.out.println("NO");

    }
    static double nextDouble(StringTokenizer tok){
    return Double.parseDouble(tok.nextToken());
}
public static int nextInt( StringTokenizer s) throws Exception {
        return Integer.parseInt(s.nextToken());
    }
public static long nextLong(StringTokenizer bu) throws Exception {
        return Long.parseLong(bu.nextToken());
    }}

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

public class C681_B {

    public static void main(String[] args) throws IOException {
        IOHelper ioh = new IOHelper();

        long n = ioh.nextLong();

            test(n);

    }

    private static void test(long n) {
        boolean found = false;
        for(long i=0;i<=810;i++){
            for(long j=0;j<=8100;j++){

                    long l = i*1234567L + j*123456L;
                    if((n-l)%1234 ==0){
                        found = true;
                        break;
                    }
                    if(l > n)
                        break;

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

    private static class IOHelper {
        private InputStreamReader isr = new InputStreamReader(System.in);
        private BufferedReader br = new BufferedReader(isr);
        private StringTokenizer tokenizer;

        public String next() throws IOException {
            while(tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(br.readLine());
            }
            return tokenizer.nextToken();
        }

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

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

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

}

import java.util.*;
public class EconomyGame{
  public static void main(String args[]){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    if((((n%1234567)%123456)%1234)==0)
      System.out.println("YES");
    else if(((n%123456)%1234)==0)
      System.out.println("YES");
    else if((n%1234)==0)
      System.out.println("YES");
    else System.out.println("NO");

  }

}

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

public class B {
    public static void main(String args[]) {
        try {
            InputReader in = new InputReader(System.in);
            int n = in.readInt();
            for (int a = 0; a < 100; a++) {
                for (int b = 0; b < 100; b++) {
                    for (int c = 0; c < 100; c++) {
                        if (a * 1234567 + b * 123456 + c * 1234 == n) {
                            System.out.println("YES");
                            return;
                        }
                    }
                }
            }
            System.out.println("NO");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
class InputReader {
    private boolean finished = false;

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

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

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

    public int peek() {
        if (numChars == -1)
            return -1;
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                return -1;
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar];
    }

    public int readInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long readLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String readString() {
        int length = readInt();
        if (length < 0)
            return null;
        byte[] bytes = new byte[length];
        for (int i = 0; i < length; i++)
            bytes[i] = (byte) read();
        try {
            return new String(bytes, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            return new String(bytes);
        }
    }

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

    private String readLine0() {
        StringBuffer buf = new StringBuffer();
        int c = read();
        while (c != '\n' && c != -1) {
            if (c != '\r')
                buf.appendCodePoint(c);
            c = read();
        }
        return buf.toString();
    }

    public String readLine() {
        String s = readLine0();
        while (s.trim().length() == 0)
            s = readLine0();
        return s;
    }

    public String readLine(boolean ignoreEmptyLines) {
        if (ignoreEmptyLines)
            return readLine();
        else
            return readLine0();
    }

    public BigInteger readBigInteger() {
        try {
            return new BigInteger(readString());
        } catch (NumberFormatException e) {
            throw new InputMismatchException();
        }
    }

    public char readCharacter() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        return (char) c;
    }

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

    public boolean isExhausted() {
        int value;
        while (isSpaceChar(value = peek()) && value != -1)
            read();
        return value == -1;
    }

    public String next() {
        return readString();
    }

    public boolean readBoolean() {
        return readInt() == 1;
    }
}

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

public class economy_game
{

	public static void main(String args[])throws IOException
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int x = 1234567;
		int y = 123456;
		int z = 1234;

		int a1 = n%x;
		int a2 = n%y;
		int a3 = n%z;

		int a4 = (n%x)%y;
		int a5 = (n%x)%z;
		int a6 = (n%y)%z;

		int a7 = ((n%x)%y)%z;

		if ((a1 == 0)||(a2 == 0)||(a3==0)||(a4==0)||(a5==0)||(a6==0)||(a7==0))
			System.out.println("YES");
		else
			System.out.println("NO");
	}

}

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int max = 27407000;
    BitSet bs = new BitSet(max);
    bs.set(1234);
    bs.set(123456);
    bs.set(1234567);

    for (int i = 1234; i < max; i++) {
      if (bs.get(i)) {
        bs.set(i+1234);
        bs.set(i+123456);
        bs.set(i+1234567);
      }
    }
    System.out.println("done");
    System.out.println(bs.previousClearBit(max-1));
    System.out.println((n > max || bs.get(n)) ? "YES" : "NO");
  }
}

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

public class main {

    public static void main(String[] args) {
        InputReader sc=new InputReader(System.in);
        int n=sc.nextInt();
        if(n%1234==0 || n%123456==0 || n%1234567==0 || n%124690==0 || n%1359257==0 || n%1358023==0 || n%1235801==0 || n==0)
        	System.out.println("YES");
        else
        	System.out.println("NO");
    }

    static class InputReader {

    private final InputStream stream;
    private final byte[] buf = new byte[8192];
    private int curChar, snumChars;
    private SpaceCharFilter filter;

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

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

    public int nextInt() {
        int c = snext();
        while (isSpaceChar(c)) {
            c = snext();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = snext();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = snext();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long nextLong() {
        int c = snext();
        while (isSpaceChar(c)) {
            c = snext();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = snext();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = snext();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

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

    public String readString() {
        int c = snext();
        while (isSpaceChar(c)) {
            c = snext();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = snext();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public String nextLine() {
        int c = snext();
        while (isSpaceChar(c))
            c = snext();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = snext();
        } while (!isEndOfLine(c));
        return res.toString();
    }

    public boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private boolean isEndOfLine(int c) {
        return c == '\n' || c == '\r' || c == -1;
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }
}
}

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

public class B {

    public static void main(String [] args) throws  Exception
    {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        StringBuilder sb = new StringBuilder();
        int n = sc.nextInt();
        int x = n / 1234;
        n%=1234;
        for(int i = 0 ; i < 100 ; ++i)
            for(int j = 0 ; j < 100 ; ++j)
                if(i * 56 + 567 * j == n)
                {
                    if(i * 100 + j * 100 <=x)
                    System.out.println("YES");
                    return;
                }
        System.out.println("NO");
        out.flush();
        out.close();
    }

    static class Scanner
    {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

        public String next() throws IOException
        {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

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

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

        public String nextLine() throws IOException {return br.readLine();}

        public double nextDouble() throws IOException
        {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if(x.charAt(0) == '-')
            {
                neg = true;
                start++;
            }
            for(int i = start; i < x.length(); i++)
                if(x.charAt(i) == '.')
                {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                }
                else
                {
                    sb.append(x.charAt(i));
                    if(dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg?-1:1);
        }

        public boolean ready() throws IOException {return br.ready();}

    }
}

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class BB
{

public static void main(String[] args)
{

    Scanner sc= new Scanner(System.in);

    int n=sc.nextInt();
    int a=1234567;
    int b=123456;
    int c=1234;

    int tot=n/a;

    for (int i = 0; i <= tot; i++) {
    int aa= i*a,bb,cc;
    int r=0;
    if(aa!=0)
    {

        r=n%aa;
    }

    int tot2=(n-aa+r)/b;

        for (int j = 0; j <= tot2; j++) {
            bb=b*j;

            int res=(n-aa-bb);

                if(res%c==0&&res>=c)
                {  System.out.println("YES");
                return;
                }

        }
    }

    System.out.println("NO");

}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class R {

	public static void main(String args[]) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));

		Scanner sc = new Scanner(System.in);

		long n = Long.parseLong(br.readLine());

		long x1 = n / 1234567;
		long x2 = n / 123456;

		for (long i = 0; i <= x1; i++)
			for (long j = 0; j <= x2; j++) {

				long val = i * 1234567 * 1l + j * 123456 * 1l;
				long temp = n - val;

				if (temp == 0) {
					System.out.println("NO");
					return;
				}

				long p = temp % 1234;

				if (p == 0) {
					System.out.println("YES");
					return;
				}
			}

		System.out.println("NO");

	}
}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Solution  {

	static class FastScanner{
		BufferedReader s;
		StringTokenizer st;

		public FastScanner(){
			st = new StringTokenizer("");
			s = new BufferedReader(new InputStreamReader(System.in));
		}

		public FastScanner(File f) throws FileNotFoundException{
			st = new StringTokenizer("");
			s = new BufferedReader (new FileReader(f));
		}

		public int nextInt() throws IOException{
			if(st.hasMoreTokens())
				return Integer.parseInt(st.nextToken());

			else{
				st = new StringTokenizer(s.readLine());
				return nextInt();
			}
		}

		public double nextDouble() throws IOException{
			if(st.hasMoreTokens())
				return Double.parseDouble(st.nextToken());
			else{
				st = new StringTokenizer(s.readLine());
				return nextDouble();
			}
		}

		public long nextLong() throws IOException{
			if(st.hasMoreTokens())
				return Long.parseLong(st.nextToken());
			else{
				st = new StringTokenizer(s.readLine());
				return nextLong();
			}
		}

		public String nextString() throws IOException{
			if(st.hasMoreTokens())
				return st.nextToken();
			else{
				st = new StringTokenizer(s.readLine());
				return nextString();
			}

		}
		public String readLine() throws IOException{
			return s.readLine();
		}

		public void close() throws IOException{
			s.close();
		}

	}

	//FastScanner s = new FastScanner(new File("input.txt"));       copy inside void solve
    //PrintWriter ww = new PrintWriter(new FileWriter("output.txt"));
    static FastScanner s = new FastScanner();
    static PrintWriter ww = new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String args[])throws IOException{
    	//Main ob=new Main();
    	Solution ob=new Solution();
		ob.solve();
		ww.close();
    }
    //////////////////////////////////////////////

    //////////////////////////////////////////////

    //////////////////////////////////////////////
    		 void solve() throws IOException {

    			 int n = s.nextInt();
    			 int a = 1234567;
    			 int b = 123456;
    			 int c = 1234;

    			 if(n < c)
    				 ww.println("NO");

    			 n-=c;
    			 String ans = "NO";
    			 for(int i=1;i<=(Math.ceil(n/a));i++){
    				 for(int j=1;j<=(Math.ceil(n/b));j++){
    					 if(a*i+b*j == n){
    						 ans = "YES";
    						 break;
    					 }

    				 }
    			 }

    			 ww.println(ans);

    		 }//solve

}

import java.util.Scanner;

public class BBBB {

	public static void main(String args[])
	{
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		for(int i=0;i<15;i++)
		{
			for(int j=0;j<160;j++)
			{
				int lol=(i*1234567)+(j*123456);
				if(lol<=n) {
				int sum=n-((i*1234567)+(j*123456));
				if(sum%1234==0)
				{
					System.out.println("YES");
					return;
				}
				}
			}
		}
		System.out.println("NO");
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.StringTokenizer;

public class B {

	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static StringTokenizer st;
	static PrintWriter out;

	public static String next() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(br.readLine());
		}
		return st.nextToken();
	}

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

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

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

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

	public static void main(String[] args) throws IOException {

		boolean res = false;

		int n = nextInt();

		int a = n / 1234567;

		for (int i = 0; i <= a; i++) {
			int tmp = n - a * 1234567;

			if (tmp % 2 == 0 && (tmp % 123456 == 0 || tmp % 1234 == 0 || tmp >= 123456 + 1234)) {
				res = true;
				break;
			}

		}

		System.out.println(res ? "YES" : "NO");
	}

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

}

import java.util.*;
public class EG {
    public static void main(String args[]) {
    Scanner in = new Scanner(System.in) ;
    int n=in.nextInt();int a=0,b=0,c=0;
    while(a<=n) {
        while(b<=n-a) {
            if(((n-(a+b))%1234)==0) {
                c=1 ;
            }
        b=b+123456;
        }
        a=a+1234567;
    }
    System.out.println(c==1?"YES":"NO");
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.util.Scanner;

import javax.net.ssl.HostnameVerifier;

public class P681_B {

	private static StreamTokenizer inputReader = new StreamTokenizer(
			new BufferedReader(new InputStreamReader(System.in)));

	private static Scanner scaner = new Scanner(System.in);

	static java.io.BufferedReader reader = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));

	public static int nextInt() {
		int a = -1;
		try {
			inputReader.nextToken();
			a = (int) inputReader.nval;
		} catch (Exception e) {
		}
		return a;
	}

	public static void main(String[] args) {
		int n = nextInt();

		int housePrice = 1234567;
		int carPrice = 123456;
		int compPrice = 1234;

		for (int i = 0; i <= 3000; i++) {
			for (int j = 0; j <= 1000; j++) {
				for (int k = 0; k <= 100; k++) {
					if (1234 * (i + 100 * j + 1000 * k) + (j * 56) + (k * 567) == n) {
						System.out.println("YES");
						return;
					}
				}
			}
		}

		System.out.println("NO");
	}

}

import java.util.Scanner;

public class Main {

	private int house = 1_234_567;
	private int cars = 123_456;
	private int computers = 1_234;

	int n;

	void run() {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();

		int amax = n / house;
		int bmax = n / cars;
		int cmax = n / computers;
		boolean f = false;

		for (int i = amax; i >= 1; i--) {
			int tmp = n - (house * i);
			for (int j = tmp / cars; j >= 1; j--) {
				int tmp2 = n - (house * i) - (cars * j);
				int k = tmp2 / computers;
				int sum = (house * i) + (cars * j) + (computers * k);
				if (sum == n) {
					f = true;
					break;
				}
			}
			if (f) {
				break;
			}
		}

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

	}

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

}

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

public class main {

    public static void main(String[] args) {
        InputReader sc=new InputReader(System.in);
        int n=sc.nextInt();
        int x=0;
       		for(int b=0;b<=n/123456;b++){
       			for(int a=0;a<=n/1234567;a++){
        		    int z=a*1234567+b*123456;
        		    int temp=n;
        		    n=n-z;
        		    if(n<0)
        		    	continue;
        		   // System.out.println(n);
       				if(n%1234==0 || n%123456==0 || n%1234567==0 || n%124690==0 || n%1359257==0 || n%1358023==0 || n%1235801==0 || n==0)
        			{	x=1;
        				break;
        			}
       				n=temp;
                }
            }
       		if(n%1234==0)
       			x=1;
        if(x==1)
        	System.out.println("YES");
        else
        	System.out.println("NO");
    }

    static class InputReader {

    private final InputStream stream;
    private final byte[] buf = new byte[8192];
    private int curChar, snumChars;
    private SpaceCharFilter filter;

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

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

    public int nextInt() {
        int c = snext();
        while (isSpaceChar(c)) {
            c = snext();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = snext();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = snext();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long nextLong() {
        int c = snext();
        while (isSpaceChar(c)) {
            c = snext();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = snext();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = snext();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

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

    public String readString() {
        int c = snext();
        while (isSpaceChar(c)) {
            c = snext();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = snext();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public String nextLine() {
        int c = snext();
        while (isSpaceChar(c))
            c = snext();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = snext();
        } while (!isEndOfLine(c));
        return res.toString();
    }

    public boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private boolean isEndOfLine(int c) {
        return c == '\n' || c == '\r' || c == -1;
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }
}
}

//package ayman;

import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

//import java.math.*;

public class Main {

	public static void main(String[] args) {

		FileInputStream instream = null;
		try {
			instream = new FileInputStream(
					"D:/Programming/EclipseNeonJava/ayman/src/ayman/input.txt");
			System.setIn(instream);
		} catch (Exception e) {
			System.err.println("Error Occurred. with files");
		}
		Scanner in = new Scanner(System.in);

		// ###########################################################################################################
		// ################################################START######################################################
		// ###########################################################################################################
		int x=in.nextInt();
		long temp;
		for(int i=1;;i++){
			temp=i*1234567;
			if(temp>x) break;
			for(int k=1;;k++){
				temp=i*1234567+k*123456;
				if(temp>x) break;
				if(x-temp>=0&&(x-temp)%1234==0){
					System.out.println("YES");
					return;
				}
			}
		}
		System.out.println("NO");
	}
}

class Pair implements Comparable<Pair> {
	int first, second;

	Pair(int first, int second) {
		this.first = first;
		this.second = second;
	}

	@Override
	public int compareTo(Pair p) {
		return first == p.first ? second - p.second : first - p.first;
	}
}

import java.util.*;

public class Test1 {
    public static void main(String at[]){
    	Scanner scan=new Scanner(System.in);
    	int n=scan.nextInt();
    	boolean flag=true;
    	int a=1234567,b=123456;
    	loop :for(int i=0;i<=1000;i++){
    		for(int j=0;j<=10000;j++){
    			int r=n-a*i-b*j;
    			if(r>=0&&r%1234==0){

    				System.out.println("YES"+" "+i+" "+j);
    				flag=false;
    				break loop;
    			}
    		}
    	}
    	if(flag)
    		System.out.println("NO");

    }
}

import java.util.Scanner;

public class Codeforces681B {
	static Scanner userInput = new Scanner(System.in);

	public static void main(String[] args) {
		Long xAra[] = new Long[10000];
		Long yAra[] = new Long[10000];
		int x = 1234567, y = 123456, z = 1234;
		int n, m;
		Long givenValue;
		for (n = 1; n <= 812; n++) {

			Long value = Long.valueOf(x * n);
			xAra[(int) n - 1] = Long.valueOf(value);
		}
		n--;
		for (m = 1; m <= 8102; m++) {
			Long value = Long.valueOf(y * m);
			yAra[m - 1] = value;
		}
		m--;

	   givenValue = userInput.nextLong();

		boolean ans = false;

		for (int i = 0; i <= n - 3; i++) {
			Long a = xAra[i];
			for (int j = 0; j <= m - 3; j++) {
				Long b = yAra[j];
				Long sub = givenValue - (a + b);
				if (a + b + z <= givenValue && sub % z == 0) {
                  // System.out.println(a%1234567+" "+(b%123456) +" "+((sub/z)*z));
					ans = true;
					break;
				}

			}
			if (ans == true)
				break;
		}

		if (ans == true)
			System.out.println("YES");

		else
			System.out.println("NO");

	}// main

}

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

/**
 * @author Alexander Tsupko (alexander.tsupko[at]outlook.com) (c) All rights reserved. June 14, 2016.
 */
public class B {
    private static class Solve {
        private final int HAUS = 1234567;
        private final int AUTO = 123456;
        private final int COMP = 1234;

        private void solve(int testNumber, InputReader in, PrintWriter out) {
            long n = in.nextLong();
            int a = 0, b = 0, c = 0;
            long total;
            do {
                total = a * HAUS + b * AUTO + c * COMP;
                a++; b++; c++;
            } while (total < n);

            out.println(n - total == 0 ? "YES" : "NO");
        }

        // private auxiliary methods and nested classes, if needed
    }

    private static class InputReader {
        private BufferedReader bufferedReader;
        private StringTokenizer stringTokenizer;

        private InputReader(InputStream inputStream) {
            bufferedReader = new BufferedReader(new InputStreamReader(inputStream), 32768);
        }

        private void close() throws IOException {
            bufferedReader.close();
        }

        private String nextLine() {
            try {
                return bufferedReader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        private String next() {
            while (stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
                stringTokenizer = new StringTokenizer(nextLine());
            }
            return stringTokenizer.nextToken();
        }

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

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

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

    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solve solve = new Solve();
//        long startTime = System.nanoTime();
        solve.solve(1, in, out);
//        int testCount = Integer.parseInt(in.next());
//        for (int i = 1; i <= testCount; i++) solve.solve(i, in, out);
//        long estimatedTime = System.nanoTime() - startTime;
//        out.printf(Locale.US, "%.1f ms\n", estimatedTime/1e6);
        in.close();
        out.flush();
        out.close();
    }
}

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

public class main {

    public static void main(String[] args) {
        InputReader sc=new InputReader(System.in);
        int n=sc.nextInt();
        int x=0;
       		for(int b=0;b<n/123456;b++){
       			for(int a=0;a<n/1234567;a++){
        		    if(n<0)
        		    	break;
        			n-=1234567;
        			if(n%1234==0 || n%123456==0 || n%1234567==0 || n%124690==0 || n%1359257==0 || n%1358023==0 || n%1235801==0 || n==0)
        			{	x=1;
        				break;
        			}
                }
            }
        if(x==1)
        	System.out.println("YES");
        else
        	System.out.println("NO");
    }

    static class InputReader {

    private final InputStream stream;
    private final byte[] buf = new byte[8192];
    private int curChar, snumChars;
    private SpaceCharFilter filter;

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

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

    public int nextInt() {
        int c = snext();
        while (isSpaceChar(c)) {
            c = snext();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = snext();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = snext();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long nextLong() {
        int c = snext();
        while (isSpaceChar(c)) {
            c = snext();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = snext();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = snext();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

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

    public String readString() {
        int c = snext();
        while (isSpaceChar(c)) {
            c = snext();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = snext();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public String nextLine() {
        int c = snext();
        while (isSpaceChar(c))
            c = snext();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = snext();
        } while (!isEndOfLine(c));
        return res.toString();
    }

    public boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private boolean isEndOfLine(int c) {
        return c == '\n' || c == '\r' || c == -1;
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }
}
}

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

public class ProblemB {
	public static void main(String[] args) {
		InputReader in = new InputReader();
		PrintWriter out = new PrintWriter(System.out);

		new ProblemB().solve(in, out);

		out.close();
	}

	public void solve(InputReader in, PrintWriter out) {
		int n = in.nextInt();

		int a = n / 1234567;

		for (int i = 0; i <= a; i++) {
			int d = n - 1234567 * i;

			int b = d / 123456;

			for (int j = 0; j <= b; j++) {
				d -= j * 123456;

				if (d % 1234 == 0) {
					out.println("YES");

					return;
				}
			}
		}

		out.println("NO");
	}

	static class InputReader {
		public BufferedReader br;
		public StringTokenizer st;

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

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

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

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

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

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

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class R {

	public static void main(String args[]) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));

		Scanner sc = new Scanner(System.in);

		long n = Long.parseLong(br.readLine());

		long x1 = n / 1234567;
		long x2 = n / 123456;

		System.out.println(1234567 * 810 * 1l + 1l * 123456 * 8100);

		for (long i = 1; i <= x1; i++)
			for (long j = 1; j <= x2; j++) {

				long val = i * 1234567 * 1l + j * 123456 * 1l;
				long temp = n - val;

				if (temp <= 0) {
					System.out.println("NO");
					return;
				}

				long p = temp % 1234;

				if (p == 0) {
					System.out.println("YES");
					return;
				}
			}

		System.out.println("NO");

	}
}