using System; using System.Collections; using System.Collections.Generic; using System.Numerics; using System.Text; using System.IO; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ public void Solve(){ int turn=0; int[] Player=new int[2]; using(FastIn rd = new FastIn(4200000)){ for(int i=0;i<1;i++){ BigInteger x=rd.ReadBI(); BigInteger y=rd.ReadBI(); if((x-1)%(y+1)==0){ Player[turn^1]++; turn^=1; }else{ Player[turn]++; } } } Console.WriteLine(Player[0]==1?1000:0); } public Sol(){ } static String rs(){return Console.ReadLine();} static int ri(){return int.Parse(Console.ReadLine());} static long rl(){return long.Parse(Console.ReadLine());} static double rd(){return double.Parse(Console.ReadLine());} static String[] rsa(){return Console.ReadLine().Split(' ');} static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));} static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));} static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));} static BigInteger[] rba(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>BigInteger.Parse(e));} } class FastIn:IDisposable { int Size; byte[] Mem; int ptr; int rsize; bool unfinished; Stream stdin; void Init(int n) { Size = n; Mem = new byte[Size]; rsize=(stdin=Console.OpenStandardInput()).Read(Mem, 0, Size); ptr = 0; unfinished=(rsize == Size); } void Next() { if (unfinished == false) return; rsize=stdin.Read(Mem, 0, Size); ptr = 0; unfinished = (rsize == Size); } ~FastIn(){ stdin.Dispose(); } void IDisposable.Dispose(){ stdin.Dispose(); } public void Dispose(){ stdin.Dispose(); } public FastIn() { Init(100000); } public FastIn(int n) { Init(n); } public int ReadInt() { int ret = 0; int sig = 1; while (ptr < rsize && Mem[ptr] != ' ' && Mem[ptr] != '\n' && Mem[ptr] != '\r' ) { if(ret==0 && Mem[ptr] == '-'){ sig *= -1; ptr++; continue; } ret = ret * 10 + Mem[ptr++] - '0'; if (ptr == Size) Next(); } while (ptr < rsize && (Mem[ptr] == ' ' || Mem[ptr] == '\n' || Mem[ptr] == '\r') ) { ptr++; if (ptr == Size) Next(); } return ret*sig; } public BigInteger ReadBI() { BigInteger ret = 0; BigInteger sig = 1; while (ptr < rsize && Mem[ptr] != ' ' && Mem[ptr] != '\n' && Mem[ptr] != '\r' ) { if(ret==0 && Mem[ptr] == '-'){ sig *= -1; ptr++; continue; } ret = ret * 10 + Mem[ptr++] - '0'; if (ptr == Size) Next(); } while (ptr < rsize && (Mem[ptr] == ' ' || Mem[ptr] == '\n' || Mem[ptr] == '\r') ) { ptr++; if (ptr == Size) Next(); } return ret*sig; } public long ReadLong() { long ret = 0; long sig = 1; while (ptr < rsize && Mem[ptr] != ' ' && Mem[ptr] != '\n' && Mem[ptr] != '\r' ) { if(ret==0 && Mem[ptr] == '-'){ sig *= -1; ptr++; continue; } ret = ret * 10 + Mem[ptr++] - '0'; if (ptr == Size) Next(); } while (ptr < rsize && (Mem[ptr] == ' ' || Mem[ptr] == '\n' || Mem[ptr] == '\r') ) { ptr++; if (ptr == Size) Next(); } return ret*sig; } public String ReadStr() { //2byte文字はNG StringBuilder sb = new StringBuilder(); while (ptr < rsize && Mem[ptr] != ' ' && Mem[ptr] != '\n' && Mem[ptr] != '\r') { sb.Append((char)Mem[ptr++]); if (ptr == Size && unfinished) Next(); } while (ptr < rsize && (Mem[ptr] == ' ' || Mem[ptr] == '\n' || Mem[ptr] == '\r') ) { ptr++; if (ptr == Size && unfinished) Next(); } return sb.ToString(); } public String ReadLine() { //極力使わない(split/parseするくらいなら上をつかう) StringBuilder sb = new StringBuilder(); while (ptr < rsize && Mem[ptr] != '\n' && Mem[ptr] != '\r') { sb.Append((char)Mem[ptr++]); if (ptr == Size && unfinished) Next(); } while (ptr < rsize && (Mem[ptr] == ' ' || Mem[ptr] == '\n' || Mem[ptr] == '\r')) { ptr++; if (ptr == Size && unfinished) Next(); } return sb.ToString(); } }