The 9-th grade student Gabriel noticed a caterpillar on a tree when walking around in a forest after the classes. The caterpillar was on the height h1 cm from the ground. On the height h2 cm (h2 > h1) on the same tree hung an apple and the caterpillar was crawling to the apple.Gabriel is interested when the caterpillar gets the apple. He noted that the caterpillar goes up by a cm per hour by day and slips down by b cm per hour by night.In how many days Gabriel should return to the forest to see the caterpillar get the apple. You can consider that the day starts at 10 am and finishes at 10 pm. Gabriel's classes finish at 2 pm. You can consider that Gabriel noticed the caterpillar just after the classes at 2 pm.Note that the forest is magic so the caterpillar can slip down under the ground and then lift to the apple.

The first line contains two integers h1, h2 (1 ≤ h1 < h2 ≤ 105) — the heights of the position of the caterpillar and the apple in centimeters. The second line contains two integers a, b (1 ≤ a, b ≤ 105) — the distance the caterpillar goes up by day and slips down by night, in centimeters per hour.

Print the only integer k — the number of days Gabriel should wait to return to the forest and see the caterpillar getting the apple. If the caterpillar can't get the apple print the only integer  - 1.

NoteIn the first example at 10 pm of the first day the caterpillar gets the height 26. At 10 am of the next day it slips down to the height 14. And finally at 6 pm of the same day the caterpillar gets the apple.Note that in the last example the caterpillar was slipping down under the ground and getting the apple on the next day.

#include<stdio.h>
int main()
{
	int h1,h2,a,b,diff=0,height=0,day,val=0;
	scanf("%d%d",&h1,&h2);
	scanf("%d%d",&a,&b);
	diff = h2-h1;
	height= diff-8*a+12*b;
	day=0;
	val=val+12*b-12*a;
	if (8*a<diff&&b>=a)
		day=-1;
	else if (8*a>diff)
		day=0;
	else
	{
		while (height>12*b)
		{
			height+=val;
			day=day+1;
		}
	}
	printf("%d",day);
	return 0;
}

#include <stdio.h>
#include <stdlib.h>

int h1,h2,a,b,nr;

int main()
{
   scanf("%d %d %d %d",&h1,&h2,&a,&b);
  h1=h1+a*8;
   if(h1>=h2)
    printf("0");
   else
    if(a<=b)
        printf("-1");
   while(h1<h2 && a>b)
   {
       h1=h1-12*b;
       h1=h1+12*a;
       nr++;

       if(h1>=h2)
    printf("%d",nr);
   }

    return 0;
}

#include<stdio.h>
int main()
{
    int n,m,a,b,i,j;
    scanf("%d %d %d %d",&n,&m,&a,&b);
    if(a<=b)
    {
        if(a*8>=(m-n))
            printf("0\n");
        else
            printf("-1\n");
    }

    else
    {
        i=0;
        while(1)
        {
            n+=8*a;
            if(n>=m)
            {
                printf("%d\n",i);
                break;
            }
            i++;
            n-=12*b;
            n+=4*a;
            if(n>=m)
            {
                printf("%d\n",i);
                break;
            }

        }
    }

    return 0;
}

#include <stdio.h>

int main()
{
    int h1, h2, a, b, count=0;
    scanf("%d %d",&h1,&h2);
    scanf("%d %d",&a,&b);
    if(a<=b && a*8<h2-h1) printf("-1\n");
    else
    {
        int temp = 0;
        while(1)
        {
            h1 = h1 + 8*a + temp;
            if(h1>=h2) break;
            else h1 = h1 - 12*b;
            count++;
            temp = 4*a;
        }
        printf("%d\n",count);
    }
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define pi 3.1415926
#define rep(x,ini,end) for(x=(ini);x<(end);x++)
#define per(x,ini,end) for(x=(end-1);x>=(ini);x--)
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))

int main()
{
    int h1, h2;
    scanf("%d %d", &h1, &h2);
    int a, b;
    scanf("%d %d", &a, &b);

    if (h2-h1<a*8)
    {
        printf("0"); return 0;
    }
    if ((h2-h1>a*8) && (a<=b))
    {
        printf("-1"); return 0;
    }

    int day = 0;
    int dayend,nightend;
    while (1)
    {
        if (day == 0)
        {
            dayend = h1 + a * 8;
        }
        else
        {
            dayend = nightend + a * 12;
        }
        if (dayend>=h2)
        {
            printf("%d",day); return 0;
        }
        nightend = dayend - b * 12;
//        if (nightend<=0)
//        {
//            printf("%d",day+1); return 0;
//        }
        day++;
    }

    return 0;
}

#include <stdio.h>

int main(){
    int a,b;
    scanf("%d%d",&a,&b);
    int ai,bi;
    scanf("%d%d",&ai,&bi);
    int k = b - (a + ai * 8);
    if(k <= 0){
        printf("0\n");
    }
    else if(ai <= bi){
        printf("-1\n");
    }
    else{
        printf("%d\n",(k - 1) / ((ai - bi) * 12) + 1);
    }
}

#include<stdio.h>
int main()
{
  long long int a,b,x,y;
  long long int ans=0;
  scanf("%lld%lld",&x,&y);
  scanf("%lld%lld",&a,&b);
  long long int d,d1,d2;
  d=y-x;
  d1=a*8;
  if (d1<d && a<=b) {
    ans=-1;
  }
  else
  {
    d2=d-d1;
    while(d2>0)
    {
      d=d2+b*12;
      d2=d-a*12;
      ans++;

    }
  }
  printf("%lld\n",ans );
  return 0;
}

#include<stdio.h>
int main(){
int a,b,c,d;
scanf("%d%d",&a,&b);
int up,down;
scanf("%d%d",&up,&down);
int minus=((8*up+a)-(12*down))+4*up;
if(minus<=a && ((8*up)+a)<b){
printf("-1");
return 0;
}
int i;
for(i=0;i<8;i++){
a=a+up;
if(a>=b){
printf("%d",0);
return 0;
}}
int cnt=0; int ind=0;
while(1){
if(!ind){
for(i=0;i<12;i++){
a=a-down;
if(a>=b){
printf("%d",cnt);
return 0;
}
}
ind=1;
cnt++;
}
else{
for(i=0;i<12;i++){
a=a+up;
if(a>=b){
printf("%d",cnt);
return 0;
}
}
ind=0;
}
}
}

#include<stdio.h>
int main()
{
	int h1,h2,a,b;
	scanf("%d%d%d%d",&h1,&h2,&a,&b);
	int x=h1+(a*8);int remh;
	if(x>=h2){
		printf("0\n");
		return 0;
	}
	else
		h1=h1+(a*8);
	if(b>=a){
		printf("-1\n");
		return 0;
	}
	long long int day=0;
	while(h1<h2)
	{
		h1=h1+12*(a-b);
		day++;
	}
	printf("%lld\n",day);
	return 0;
}

#include<stdio.h>

int main()
{
    long long int i,h1,h2,a,b,dis,final1;
    scanf("%I64d %I64d",&h1,&h2);
    scanf("%I64d %I64d",&a,&b);
    dis=h1;
    final1=h2;

    i=0;
    while(dis<=h2)
    {
        if(i==0)
        {
            dis=dis+8*a;
        }
        if(i>=1)
            dis=dis+(12*a);
        if(dis>=h2)
            break;
        dis=dis-(2*b);
        if(dis>=h2)
            break;
        i++;
        dis=dis-(10*b);
        if(dis>=h2)
            break;
        if(i>=9000)
        {
            printf("-1");
            return 0;
        }
    }
    printf("%I64d",i);
    return 0;
}

#include <stdio.h>

/*
 * http://codeforces.com/problemset/problem/652/A
 */
int main()
{
    int hc = 0, ha = 0;
    scanf("%d %d", &hc, &ha);

    int a = 0, b = 0, d = 0;
    scanf("%d %d", &a, &b);

    hc += 8 * a;

    if (hc < ha && a <= b) {
        printf("-1\n");

        return 0;
    }

    while (hc < ha) {
        hc += a * 12 - b * 12;
        d += 1;
    }

    printf("%d\n", d);

    return 0;
}

#include<stdio.h>
#define max 100000
int main(){
	long long int a,b,h1,h2,count,flag;
	count=0;
	scanf("%I64d%*c%I64d",&h1,&h2);
	scanf("%I64d%*c%I64d",&a,&b);
	h1=(h1-(4*a));
	flag=0;
	if((h1+(12*a))<h2 && a<=b){
		printf("-1");
		return 0;
	}
	else{
			while(1){
			if((h1+(12*a))>=h2){
				flag=1;
				break;
			}
			else{
				h1=h1+(12*(a-b));
				count++;
			}
		}
	}
	if(flag==1){
		printf("%I64d",count);
	}
	else{
		printf("-1");
	}
	return 0;
}

#include <stdio.h>
#include <stdlib.h>

int
main (int argc, char *argv[])
{
	long int h1,h2,a,b,number=1;
	scanf("%ld %ld",&h1,&h2);
	scanf("%ld %ld",&a,&b);
	int night=12,day=8;
	if (day*a>=h2-h1)
		printf("0\n");
	else if (a<=b)
		printf("-1\n");
	else
	{
		while(a*day+number*(a-b)*night < h2-h1)
			number++;
		printf("%ld \n", number);
	}
	return 0;
}

#include <stdio.h>

int main() {
    int h1, h2, a, b;
    scanf("%d %d", &h1, &h2);
    scanf("%d %d", &a, &b);

    if (h1 + 8 * a >= h2)
        printf("0");
    else if (a <= b)
        printf("-1");
    else {
        int c = h1 + 8 * a - 12 * b, s = 1;
        while (1) {
            int night = c + a * 12;
            if (c <= h2 && h2 <= night) {
                printf("%d", s);
                return 0;
            }
            c = night - 12 * b, s++;
        }
    }
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main () {

	int a, b;
	int h1, h2;
	int i = 0;
	int j = 14;

	scanf("%d %d", &h1, &h2);
	scanf("%d %d", &a, &b);
// printf("%d %d\n", h1, h2);
// printf("%d %d\n", a, b);
	if (h1 + 8 * a >= h2) { //alcanca no 1 dia
		printf("0\n");
		return 0;
	}
	if (a <= b) {
		printf("-1\n");
		return 0;
	}
// 	printf("#\n");
	while (1) {
// 		printf("%d %d\n", h1, h2);

		if (10 <= j && j < 22) { //dia
			h1 += a * (22 - j);

			if (h1 >= h2) {
// 				if (h1 - 8 * a >= h2)
// 					i--;
				printf("%d\n", i);
				break;
			}
			i++;
			j = 22;
		} else { //noite
			h1 -= b * (j - 10);
			j = 10;
		}
	}

	return 0;

}

#include <stdio.h>

int main(void) {
	long long h1,h2,a,b,k,res;
	scanf("%lld%lld",&h1,&h2);
	scanf("%lld%lld",&a,&b);
	if(a<b)
	{
	    if ((h1+=a*8)<h2)
	    printf("-1");
	    else
	    printf("0");
	}
	if(a==b)
	{
	    if((h1+=a*8)<h2)
	    {
	    printf("-1");
	    }
	    else
	    printf("0");
	}
	if(a>b)
	{
	    k=0;res=0;
	while (h1 < h2)
	{
	    if(k == 0)
		    h1 = h1 + a * 8;
		else
		    h1 = h1 + a * 12;
		k++;
		if (h1 > h2 && (k == 1))
		{
			printf("0");
			return 0;
		}
		if(h1 >= h2)
		{
		    printf("%lld",res);
		    return 0;
		}
		h1 = h1 - 12 * b;
		res++;
	}
		printf("%lld",res);
}

	return 0;
}

#include <stdio.h>

int main()
{
    int h1,h2,a,b;
    while(scanf("%d %d",&h1,&h2)!=EOF)
    {
        scanf("%d %d",&a,&b);
        int c=0,flag=0;
        while(1)
        {
                h1+=8*a;
                if(h1>=h2)
                    break;
                if(a*12<=b*12)
                {
                    flag=1;
                    break;
                }
                h1=h1-12*b+4*a;
                c++;
                if(h1>=h2)
                    break;
        }
        if(flag)
            printf("-1\n");
        else
            printf("%d\n",c);
    }
    return 0;
}

#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>

int main(){
    int h1,h2,a,b;
    scanf("%d %d\n%d %d",&h1,&h2,&a,&b);
    h1+=8*a;
    if(h1>=h2)
        printf("0");
    else if(a<=b)
        printf("-1");
    else{
        int diff = h2-h1;
        int mul = 12*(a-b);
        if(diff%mul==0)
            printf("%d",diff/mul);
        else
            printf("%d",diff/mul+1);
    }
    return 0;
}

#include<stdio.h>
int main()
{
    int a,b,c,d,x,y,i,j,cnt=0,flag;

    scanf("%d%d%d%d",&a,&b,&c,&d);
    if(d>=c&&(b-a-8*c)>0)
       flag=0;
    else
    flag=1;
   if(flag==1) {j=(b-a-8*c);
   i=0;
    while(1)
    {
       if(j<=0)
       {
           break;
       }
       cnt++;
       j=j+12*d;
       j=j-(12*c);

    }
    printf("%d",cnt);}

if(flag==0)
    printf("-1");

    }

#include<stdio.h>
int main()
{
	int h1,h2;
	int a,b;
	scanf("%d %d",&h1,&h2);
	scanf("%d %d",&a,&b);
	int no;
	int flag =0;
	int count =0;
	while(1)
	{
		if(count ==0)
			h1 = h1+(8*a);
		else
			h1=h1+(12 * a);
		if(h1 < h2)
			h1=h1-(12 * b);
		if(h1>=h2)
		{
			flag =2;
			break;
		}
		if(b>a ||( (b==a)&&(h1<h2)))
		{
			flag =1;
			break;
		}
		count++;
	}
	if(flag ==1)
		printf("-1");
	else
	{
		printf("%d",count);
	}
	return 0;
}

#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
    int a,b,c,d,e,t,r=0,i,p=0,j;
    scanf("%d %d %d %d",&a,&b,&c,&d);

    i=8*c;
    e=b-a;
    t=12*(c-d);
    if(i>=e)
       r=0;
    else if(t<1)
        r=-1;
    else{
        p=i+t;
      for(j=1;;j++){
        if(p>=e){
          r++;
          break;
        }
        else{
            r++;
            p=p+t;
        }

      }

    }

    printf("%d",r);

return 0;
}

#include<stdio.h>
#define MOD 1000000007
typedef long long int llu;
llu mod(llu a) {
	return a>0?a:-1*a;
}
int main()
{
	llu h1,h2,a,b,i,ans=0;
	scanf("%I64d%I64d",&h1,&h2);
	scanf("%I64d%I64d",&a,&b);
	if(b>=a) {
		if( h2>8*a+h1 )
			ans = -1;
		else
			ans = 0;
	}
	else {
		if(h1+8*a>=h2) {
			ans = 0;
		}
		else {
			ans = (h2-(h1+8*a))/(12*(mod(b-a)));
			if((h2-(h1+8*a))%(12*(mod(b-a))))
				ans++;
		}
	}
	printf("%I64d",ans);
	return 0;
}

#include<stdio.h>
int main(){
int n,m,a,b;
while(scanf("%d%d%d%d",&n,&m,&a,&b)!=EOF){
    if(n+8*a>=m) printf("0\n");
        else if(a<=b) printf("-1\n");
        else {
            int i;
            n+=8*a;
            for(i=0;;i++){
               // printf("i=%d,n=%d\n",i,n);
                if(n>=m) break;
                n-=12*b;
                n+=12*a;
            }
            printf("%d\n",i);
        }
    }
return 0;
}

#include <stdio.h>
//#pragma warning (disable : 4996)
int main(int argc, char * argv[])
{
	int a, b; scanf("%d %d", &a, &b);
	int c, d; scanf("%d %d", &c, &d);
	int day = 0;
	a += 8 * c;
	while (1)
	{

		if (a >= b)
		{
			printf("%d", day);
			break;
		}
		if (d >= c)
		{
			printf("-1");
			break;
		}
		day++;
		a += 12 * c - 12 * d;

	}
	return 0;
}

# include <stdio.h>

int main ()
{
    int a,b,u,v;
    scanf("%d %d %d %d",&a,&b,&u,&v);
    int x=b-a;
    int z=12*v;
    int y=8*u;
    int w=12*u;
    if(x<=(8*u)) {printf("0"); return 0;}
    if(x>(8*u) && u<v) {printf("-1"); return 0;}
    //if(a+y-z < 0) {printf("1"); return 0;}
    else a=a+y-z;
    //if(a+y<0) printf("1") return 0;
    for(long int i=1;i<100005;i++){
        if(a+w>=b)
            {printf("%ld",i);
                return 0;}
        else a=a+w-z;
         continue;
    }
    printf("-1");
    return 0;
}

#include <stdio.h>

int main()
{
  int h1, h2, a, b, ans = 0;
  scanf("%d %d", &h1, &h2);
  scanf("%d %d", &a, &b);

  if (a <= b && h2 - h1 - a * 8 > 0) {
    printf("-1\n");
    return 0;
  }

  int dis = h2 - h1 - a * 8;
  if (dis <= 0) {
    printf("0\n");
    return 0;
  }
  ans += 1;

  while (dis > 0) {
    dis -= (a - b) * 12;
    if (dis <= 0) break;
    ans+= 1;
  }

  printf("%d\n", ans);
  return 0;
}

#include <stdio.h>

int main()
{
	int h1, h2, up = 0, down = 0;

	fscanf(stdin, "%d %d %d %d", &h1, &h2, &up, &down);

	int days = 0;
	int currentHour = 14;
	int flag = 0;

	while (1)
	{

		if ((currentHour >= 10)  && (currentHour < 22))
		{
			h1 += up;
			currentHour++;
			if (h1 >= h2)
			{
				break;
			}
		}
		else
		{
			if (currentHour == 23)
			{
				currentHour = 0;
				flag = 1;
				days++;
			}
			else
			{
				currentHour++;
			}
			h1 -= down;
		}

		if ((down >= up) && (flag == 1))
		{
			days = -1;
			break;
		}
	}

	printf("%d", days);

}

#include <stdio.h>

#define S_N 8
#define DN 12
#define D_S 4

int main() {

    int h1, h2;
    int a, b;

    scanf("%d%d", &h1, &h2);
    scanf("%d%d", &a, &b);

    h1 += S_N * a;
    if (h1 >= h2) {
        printf("0");
        return 0;
    }
    if (a <= b) {
        printf("-1");
        return 0;
    }
    if ((h2 - h1) % ((a - b) * DN))
        printf("%d", (h2 - h1) / ((a - b) * DN) + 1);
    else
        printf("%d", (h2 - h1) / ((a - b) * DN));
    return 0;

}

#include<stdio.h>
int main()
{
    int h1,h2,a,b;
    scanf("%d%d%d%d",&h1,&h2,&a,&b);
    if(a<=b && h1+8*a<h2)
    {
        printf("-1\n");
        return 0;
    }
    int ans=0;
    while(1)
    {
        h1=h1+8*a;
        if(h1>=h2)
        {
            break;
        }
        h1=h1-b*12;
        ans++;
        h1=h1+4*a;
    }
    printf("%d\n",ans);
    return 0;
}

#include <stdio.h>
int main()
{
    int h1, h2, a, b, day = 0;
    scanf("%d%d%d%d", &h1, &h2, &a, &b);
    h1 += a*8;
    if( h1>=h2 )
    printf("0\n");
    else
    {
       day++;
       while(1)
       {
           h1 -= b*12;
h1 += a*12;
 if( h1>=h2 )
{
 printf("%d\n", day);
 break;
 }
 if( b>=a )
 {
 printf("-1\n");
            break;
        }
        day++;
        }
    }
    return 0;
}

#include<stdio.h>
int main()
{
    long long int x,y,a,b,i,l=0;
    scanf("%lld %lld",&x,&y);
    scanf("%lld %lld",&a,&b);
    if(8*a+x>=y)
    {printf("0");}
    else
    {if(b>=a)
     {printf("-1");}
     else
     {x=x+8*a-12*b;
      i=0;
      while(x<y)
      { i++;
        x=x+(12*a);
        if(x>=y)
        {printf("%lld",i);
         break;
        }
        x=x-12*b;
      }
     }
    }
    return 0;
}

#include<stdio.h>
int main ()
{
	int h1,h2,a,b;
	scanf("%d %d",&h1,&h2);
	scanf("%d %d",&a,&b);
	if(h2-h1<=8*a) printf("%d",0);
	else if(a<=b) printf("%d",-1);
	else{
	h1=h1+a*8-b*12;
	int count=1;
	while(h1+12*a<h2){
		h1=a*12+h1-b*12;
		count++;
	}
	printf("%d",count);}
	return 0;
}

#include <stdio.h>
#include <string.h>
#include <stdbool.h>

#define clr(ar) memset(ar, 0, sizeof(ar))
#define read() freopen("lol.txt", "r", stdin)

int main(){
    long long i, j, k, l, x, h1, h2, a, b;

    while (scanf("%lld %lld %lld %lld", &h1, &h2, &a, &b) != EOF){
        long long hour = 14, days = 0, lim = 1e8;

        while (h1 < h2 && lim--){
            if (hour >= 10 && hour < 22) h1 += a;
            else h1 -= b;
            hour++;
            if (hour == 24) hour = 0;
            if (hour == 10) days++;
        }

        if (lim <= 0) days = -1;
        printf("%lld\n", days);
    }
    return 0;
}

#include<stdio.h>
#include<string.h>
int main()
{
	int s,e;
	int u,d;
	int len;
	int day=0,flag=1;
	scanf("%d %d",&s,&e);
	scanf("%d %d",&u,&d);
	len=e-s;
	if(u*8>=len) printf("0\n");
	else if(u<=d) printf("-1\n");
	else
	{
		day=0;flag=1;
		len=len-u*8;
		while(flag==1)
		{
			len+=12*d;
			len-=12*u;
			day++;
			if(len<=0) flag=0;
		}
		printf("%d\n",day);
	}
}

#include <stdio.h>

/*
 * http://codeforces.com/problemset/problem/652/A
 */
int main()
{
    int hc = 0, ha = 0;
    scanf("%d %d", &hc, &ha);

    int a = 0, b = 0, d = 0;
    scanf("%d %d", &a, &b);

    hc += 8 * a;

    if (hc < ha && a <= b) {
        printf("-1\n");

        return 0;
    }

    while (hc < ha) {
        hc += a * 12 - b * 12;
        d += 1;
    }

    printf("%d\n", d);

    return 0;
}

#include<stdio.h>
#include<stdbool.h>

int main(){
    long long int h1,h2,a,b;
     scanf("%lld %lld",&h1,&h2);
     scanf("%lld %lld",&a,&b);
     int i;
     long long int dist=h1;
     bool day=1,first=1,sec=1;
     long long int count=0;
     if(b>=a&&(h2-h1)>(8*a))
      printf("-1");
      else{
      while(1){
           if(dist>=h2)
            break;
           if(day&&first){
            dist+=(a*8);
            day=0;
            first=0;
           }
           else if(!day){
            dist-=(b*12);
            count++;
            day=1;
           }
           else if(!first){
               dist+=(a*12);
               day=0;
               sec=0;
           }

      }
      }
      if(dist>=h2)
      printf("%lld",count);

}

#include<stdio.h>
int main()
{
    int h1,h2,a,b,d1,s,p,count=0;
    scanf("%d%d",&h1,&h2);
    scanf("%d%d",&a,&b);

    d1=a*8;

    s=h1+d1;
    if(h1+d1<h2)
    {
        if(a<=b)
        {
            printf("-1");
        }
        else
        {
        while(1)
        {

            if(s>=h2)
            {
                printf("%d",count);
                break;
            }
            else
            {
                s=s-(b*12);
                s=s+(a*12);
                count++;

            }
        }
        }
    }
    else
    {
        printf("0");
    }
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    long long h1,h2,a,b,h,step,days;

    scanf("%lld %lld",&h1,&h2);
    scanf("%lld %lld",&a,&b);

    if(b>=a && (8*a)<(h2-h1))
        printf("-1");

    else if(8*a >= h2-h1)
        printf("0");

    else
    {
        h = h2 - (h1 + 8*a);
        step = 12*(a-b);
        days = ceil((double)h/step);
        printf("%lld",days);
    }

    return 0;
}

#include<stdio.h>
int main(){
    int a,b,c,d,e,f,g;
    int first,second;
    int up,down;
    scanf("%d%d",&first,&second);
    scanf("%d%d",&up,&down);
    if(((first + 8*up) - (12 * down) + 4*up) <= first && (((8*up)+first) < second)){
    printf("-1");
    return 0;}
    if(up == down && (((8*up)+first) < second)){
    printf("-1");
    return 0;
    }
    int cnt=0,i;
    if(first>=second){
    printf("0");
    return 0;}
    while(1){
    for(i=0;i<8;i++){
    first+=up;
    if(first>=second){
    printf("%d",cnt);
    return 0;
    }}
    for(i=0;i<12;i++){
    first-=down;
    if(first>=second){
    printf("%d",cnt);
    return 0;
    }}
    cnt++;
    for(i=0;i<4;i++){
    first+=up;
    if(first>=second){
    printf("%d",cnt);
    return 0;
    }}
    }
}

#include<stdio.h>
typedef unsigned u;
int h1,h2;
int main()
{
	u t=0,c=10,a,b;
	scanf("%i%i%u%u",&h1,&h2,&a,&b);
	for(h1-=4*a;h1<h2;++c)
	{
		if(c==24){c=0;++t;if(a<=b){t=-1;break;}}
		if(c>9&&c<22)h1+=a;
		else h1-=b;
	}
	printf("%i\n",t);
	return 0;
}

#include<stdio.h>

int main()
{
    int i , ha , hc , a , b ;

    scanf("%d%d%d%d",&hc,&ha,&a,&b) ;

    if((b>a && 8*a < ha-hc) || (b==a && 12*a < ha-hc+12*b-8*a))
    {
        printf("-1");
        return 0 ;
    }

    for(i=0 ; ; i++)
    {
        if(!i)hc += a*8;
        else hc += a*12 ;

        if(hc >= ha)
        {
            printf("%d",i);
            return 0 ;
        }
        hc -= b*12 ;
    }

    return 0 ;
}

#include <stdio.h>

int main()
{
    int h1,h2,a,b,day=0,h,p=0;
    scanf("%d %d %d %d",&h1,&h2,&a,&b);
    h=h1+a*8;
    if(h>=h2)
        printf("0");
    else
    {
        while(h<h2)
        {
            h=h-12*b+12*a;
            day+=1;
            if(b>=a && day>1)
            {
                printf("-1");
                p=1;
                break;
            }
        }
        if(p!=1)
            printf("%d",day);
    }
    return 0;
}

#include<stdio.h>

int cat(int a,int b,int h1, int h2,int d,int v,int z)
{   int pos=0,k=0,nh;
    if((z==h1) && (d>0))
    {
        k=-1;
	printf("%d",k);
	return 0;
    }
       pos=(a*8)+h1;
    if(pos>=h2)
    {
        k=d;
        printf("%d",k);
        return 0;
    }
    d++;
    pos-=(b*12);
    pos=pos+a*4;
    nh=pos;
    if(v>pos && d>2)
    {
        d=-1;
	printf("%d",d);
	return 0;
    }
     if(pos>=h2)
    {
        k=d;
        printf("%d",k);
        return 0;
    }
    cat(a,b,nh,h2,d,pos,z);
}

int main()
{
    int a,b,h1,h2,d=0,v=0;
    scanf("%d%d",&h1,&h2);
    scanf("%d%d",&a,&b);

cat(a,b,h1,h2,d,v,h1);
return 0;
}

// Gabriel and Caterpillar

#include<stdio.h>
int main(void)
{
	int h1,h2,x,a,b,i,count,flag;
	scanf("%d %d",&h1,&h2);
	scanf("%d %d",&a,&b);
	if(h1<h2)
	{
		x = h1 - 4*a;
		count = 0;
		for(i = 0;;i++)
		{
			count+=1;
			x = x+12*a;
			if(x>=h2)
			{
				flag = 1;
				break;
			}
			x = x-12*b;
			if(x<=(h1-4*a))
			{
				flag = 0;
				break;
			}
		}
		if(flag==0)
			printf("-1\n");
		else if(flag==1)
			printf("%d\n",count-1);
	}
	return 0;
}

#include <stdio.h>

int main()
{
    int h1, h2, a, b, count=0;
    scanf("%d %d",&h1,&h2);
    scanf("%d %d",&a,&b);
    if(a<b) printf("-1\n");
    else if(a==b) printf("0\n");
    else
    {
        int temp = 0;
        while(1)
        {
            h1 = h1 + 8*a + temp;
            if(h1>=h2) break;
            else h1 = h1 - 12*b;
            count++;
            temp = 4*a;
        }
        printf("%d\n",count);
    }
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define pi 3.1415926
#define rep(x,ini,end) for(x=(ini);x<(end);x++)
#define per(x,ini,end) for(x=(end-1);x>=(ini);x--)
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))

int main()
{
    int h1, h2;
    scanf("%d %d", &h1, &h2);
    int a, b;
    scanf("%d %d", &a, &b);

    if (h2-h1<a*8)
    {
        printf("0"); return 0;
    }
    if ((h2-h1>a*8) && (h2+a*8-b*12>0) && (a<=b))
    {
        printf("-1"); return 0;
    }

    int day = 0;
    int dayend,nightend;
    while (1)
    {
        if (day == 0)
        {
            dayend = h1 + a * 8;
        }
        else
        {
            dayend = nightend + a * 12;
        }
        if (dayend>=h2)
        {
            printf("%d",day); return 0;
        }
        nightend = dayend - b * 12;
//        if (nightend<=0)
//        {
//            printf("%d",day+1); return 0;
//        }
        day++;
    }

    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define pi 3.1415926
#define rep(x,ini,end) for(x=(ini);x<(end);x++)
#define per(x,ini,end) for(x=(end-1);x>=(ini);x--)
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))

int main()
{
    int h1, h2;
    scanf("%d %d", &h1, &h2);
    int a, b;
    scanf("%d %d", &a, &b);

    if (h2-h1<a*8)
    {
        printf("0"); return 0;
    }
    if ((h2-h1>a*8) && (h2+a*8-b*12>0) && (a<=b))
    {
        printf("-1"); return 0;
    }

    int day = 0;
    int dayend,nightend;
    while (1)
    {
        if (day == 0)
        {
            dayend = h1 + a * 8;
        }
        else
        {
            dayend = nightend + a * 12;
        }
        if (dayend>=h2)
        {
            printf("%d",day); return 0;
        }
        nightend = dayend - b * 12;
        if (nightend<=0)
        {
            printf("%d",day+1); return 0;
        }
        day++;
    }

    return 0;
}

#include<stdio.h>
int main(){
int a,b,c,d;
scanf("%d%d",&a,&b);
int up,down;
scanf("%d%d",&up,&down);
int minus=((8*up+a)-(12*down))+4*up;
if(minus<=a && ((8*up)+a)<b){
printf("-1");
return 0;
}
int i;
for(i=0;i<8;i++){
a=a+up;
if(a>b){
printf("%d",0);
return 0;
}}
int cnt=0; int ind=0;
while(1){
if(!ind){
for(i=0;i<12;i++){
a=a-down;
if(a>b){
printf("%d",cnt);
return 0;
}
}
ind=1;
cnt++;
}
else{
for(i=0;i<12;i++){
a=a+up;
if(a>b){
printf("%d",cnt);
return 0;
}
}
ind=0;
}
}
}

#include<stdio.h>
int main(){
int a,b,c,d;
scanf("%d%d",&a,&b);
int up,down;
scanf("%d%d",&up,&down);
int minus=((8*up+a)-(12*down))+4*up;
if(minus<0){
    printf("-1");
return 0;
}
if(minus==0 && (8*up)<b){
printf("-1");
return 0;
}
int i;
for(i=0;i<8;i++){
a=a+up;
if(a>b){
printf("%d",0);
return 0;
}
}
int cnt=0; int ind=0;
while(1){
if(!ind){
for(i=0;i<12;i++){
a=a-down;
if(a>b){
printf("%d",cnt);
return 0;
}
}
ind=1;
cnt++;
}
else{
for(i=0;i<12;i++){
a=a+up;
if(a>b){
printf("%d",cnt);
return 0;
}
}
}
}
}

#include<stdio.h>
int main(){
int a,b,c,d;
scanf("%d%d",&a,&b);
int up,down;
scanf("%d%d",&up,&down);
int minus=((8*up+a)-(12*down))+4*up;
if(minus<0){
    printf("-1");
return 0;
}
if(minus==a && ((8*up)+a)<b){
printf("-1");
return 0;
}
int i;
for(i=0;i<8;i++){
a=a+up;
if(a>b){
printf("%d",0);
return 0;
}}
int cnt=0; int ind=0;
while(1){
if(!ind){
for(i=0;i<12;i++){
a=a-down;
if(a>b){
printf("%d",cnt);
return 0;
}
}
ind=1;
cnt++;
}
else{
for(i=0;i<12;i++){
a=a+up;
if(a>b){
printf("%d",cnt);
return 0;
}
}
ind=0;
}
}
}

#include<stdio.h>

int main()
{
    long long int i,h1,h2,a,b,dis,final1;
    scanf("%I64d %I64d",&h1,&h2);
    scanf("%I64d %I64d",&a,&b);
    dis=h1;
    final1=h2;
    if(a<b)
    {
        printf("-1");
        return 0;
    }
    i=0;
    while(1)
    {
        if(i==0)
        {
            dis=dis+8*a;
        }
        else
            dis+=12*a;
        if(dis>=final1)
            break;
        dis-=12*b;
        i++;
    }
    printf("%I64d",i);
    return 0;
}

#include<stdio.h>

int main()
{
    long int i,h1,h2,a,b,dis,final1;
    scanf("%ld %ld",&h1,&h2);
    scanf("%ld %ld",&a,&b);
    dis=h1;
    final1=h2;

    i=0;
    while(dis<=h2)
    {
        if(i==0)
        {
            dis=dis+8*a;
        }
        if(i>=1)
            dis=dis+(12*a);
        if(dis>=h2)
            break;
        dis=dis-(2*b);
        if(dis>=h2)
            break;
        i++;
        dis=dis-(10*b);
        if(dis>=h2)
            break;
        if(i>=10000000)
        {
            printf("-1");
            return 0;
        }
    }
    printf("%ld",i);
    return 0;
}

#include<stdio.h>

int main()
{
    long int i,h1,h2,a,b,dis,final1;
    scanf("%ld %ld",&h1,&h2);
    scanf("%ld %ld",&a,&b);
    dis=h1;
    final1=h2;
    if(a<b&&h2>h1||a<b)
    {
        printf("-1");
        return 0;
    }
    i=0;
    while(dis<=final1)
    {
        if(i==0)
        {
            dis=dis+8*a;
        }
        else
            dis=dis+(12*a);
        if(dis>=final1)
            break;
        dis=dis-(12*b);
        i++;
        if(i>=100000)
        {
            printf("-1");
            return 0;
        }
    }
    printf("%ld",i);
    return 0;
}

#include<stdio.h>

int main()
{
    long int i,h1,h2,a,b,dis,final1;
    scanf("%ld %ld",&h1,&h2);
    scanf("%ld %ld",&a,&b);
    dis=h1;
    final1=h2;

    i=0;
    while(dis<=h2)
    {
        if(i==0)
        {
            dis=dis+8*a;
        }
        if(i>=1)
            dis=dis+(12*a);
        if(dis>=h2)
            break;
        dis=dis-(2*b);
        if(dis>=h2)
            break;
        i++;
        dis=dis-(10*b);
        if(dis>=h2)
            break;
        if(i>=1000)
        {
            printf("-1");
            return 0;
        }
    }
    printf("%ld",i);
    return 0;
}

#include<stdio.h>

int main()
{
    long long int i,h1,h2,a,b,dis,final1;
    scanf("%I64d %I64d",&h1,&h2);
    scanf("%I64d %I64d",&a,&b);
    dis=h1;
    final1=h2;
    if(a<b)
    {
        printf("-1");
        return 0;
    }
    i=0;
    while(1)
    {
        if(i==0)
        {
            dis=dis+8*a;
        }
        else
            dis+=12*a;
        if(dis>=final1)
            break;
        dis-=12*b;
        i++;
        if(i>=100000)
        {
            printf("-1");
            return 0;
        }
    }
    printf("%I64d",i);
    return 0;
}

#include<stdio.h>

int main()
{
    long int i,h1,h2,a,b,dis,final1;
    scanf("%ld %ld",&h1,&h2);
    scanf("%ld %ld",&a,&b);
    dis=h1;
    final1=h2;
    if(a<b&&h2>h1)
    {
        printf("-1");
        return 0;
    }
    i=0;
    while(dis<final1)
    {
        if(i==0)
        {
            dis=dis+8*a;
        }
        else
            dis+=12*a;
        if(dis>=final1)
            break;
        dis-=12*b;
        i++;
        if(i>=100000)
        {
            printf("-1");
            return 0;
        }
    }
    printf("%ld",i);
    return 0;
}

#include<stdio.h>

int main()
{
    long int i,h1,h2,a,b,dis,final1;
    scanf("%ld %ld",&h1,&h2);
    scanf("%ld %ld",&a,&b);
    dis=h1;
    final1=h2;

    i=0;
    while(dis<=h2)
    {
        if(i==0)
        {
            dis=dis+8*a;
        }
        if(i>=1)
            dis=dis+(12*a);
        if(dis>=h2)
            break;
        dis=dis-(2*b);
        if(dis>=h2)
            break;
        i++;
        dis=dis-(10*b);
        if(dis>=h2)
            break;
        if(i>=100000)
        {
            printf("-1");
            return 0;
        }
    }
    printf("%ld",i);
    return 0;
}

#include<stdio.h>

int main()
{
    long long int i,h1,h2,a,b,dis,final1;
    scanf("%I64d %I64d",&h1,&h2);
    scanf("%I64d %I64d",&a,&b);
    dis=h1;
    final1=h2;
    if(a<b)
    {
        printf("-1");
        return 0;
    }
    for(i=0;;i++)
    {
        if(i==0)
        {
            dis+=8*a;
        }
        else
            dis+=12*a;
        if(dis>=final1)
            break;
        dis-=12*b;
    }
    printf("%I64d",i);
    return 0;
}

#include<stdio.h>

int main()
{
    long int i,h1,h2,a,b,dis,final1;
    scanf("%ld %ld",&h1,&h2);
    scanf("%ld %ld",&a,&b);
    dis=h1;
    final1=h2;

    i=0;
    while(dis<=h2)
    {
        if(i==0)
        {
            dis=dis+8*a;
        }
        if(i>=1)
            dis=dis+(12*a);
        if(dis>=h2)
            break;
        dis=dis-(2*b);
        if(dis>=h2)
            break;
        i++;
        dis=dis-(10*b);
        if(dis>=h2)
            break;
        if(i>=9999)
        {
            printf("-1");
            return 0;
        }
    }
    printf("%ld",i);
    return 0;
}

#include<stdio.h>

int main()
{
    long long int h1,h2,a,b,day;
    scanf("%I64d %I64d",&h1,&h2);
    scanf("%I64d %I64d",&a,&b);
    day=(a+b)/(h1+h2)+(a-b);
    printf("%I64d",day);
    return 0;
}

#include<stdio.h>

int main()
{
    int h1,h2,a,b,k,c=0;
    scanf("%d %d",&h1,&h2);
    scanf("%d %d",&a,&b);
    k=8*a;
    if(a-b>0){
            while(k<h2-h1){
                c++;
                k=k+12*(a-b);
            }

            printf("%d",c);

    }
    else if(a-b<0)printf("-1");
    else printf("0");

    return 0;
}

#include<stdio.h>

int main()
{
    int h1,h2,a,b;
    scanf("%d %d",&h1,&h2);
    scanf("%d %d",&a,&b);

    if(a-b>0)printf("1");
    else if(a-b<0)printf("-1");
    else printf("0");

    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main () {

	int a, b;
	int h1, h2;
	int i = 0;
	int j = 14;

	scanf("%d %d", &h1, &h2);
	scanf("%d %d", &a, &b);
// printf("%d %d\n", h1, h2);
// printf("%d %d\n", a, b);
	if (h1 + 8 * a >= h2) { //alcanca no 1 dia
		printf("0\n");
		return 0;
	}
	if (a < b) {
		printf("-1\n");
		return 0;
	}
// 	printf("#\n");
	while (1) {
// 		printf("%d %d\n", h1, h2);
		if (i == 5)
			break;
		if (10 <= j && j < 22) { //dia
			h1 += a * (22 - j);

			if (h1 >= h2) {
				printf("%d\n", i);
				break;
			}
			i++;
			j = 22;
		} else { //noite
			h1 -= b * (j - 10);
			j = 10;
		}
	}

	return 0;

}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main () {

	int a, b;
	int h1, h2;
	int i = 0;
	int j = 14;

	scanf("%d %d", &h1, &h2);
	scanf("%d %d", &a, &b);
// printf("%d %d\n", h1, h2);
// printf("%d %d\n", a, b);
	if (h1 + 8 * a >= h2) { //alcanca no 1 dia
		printf("0\n");
		return 0;
	}
	if (a < b) {
		printf("-1\n");
		return 0;
	}
// 	printf("#\n");
	while (1) {
// 		printf("%d %d\n", h1, h2);
		if (i == 5)
			break;
		if (10 <= j && j < 22) { //dia
			h1 += a * (22 - j);

			if (h1 >= h2) {
				if (h1 - 8 * a >= h2)
					i--;
				printf("%d\n", i);
				break;
			}
			i++;
			j = 22;
		} else { //noite
			h1 -= b * (j - 10);
			j = 10;
		}
	}

	return 0;

}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main () {

	long long a, b;
	long long h1, h2;
	long long res;

	scanf("%I64d %I64d", &h1, &h2);
	scanf("%I64d %I64d", &a, &b);
// printf("%d %d\n", h1, h2);
// printf("%d %d\n", a, b);
	if (h1 + 8 * a >= h2) { //alcanca no 1 dia
		printf("0\n");
		return 0;
	}
	if (a <= b) {
		printf("-1\n");
		return 0;
	}

	h1 += 8 * a;

	res = (h2 - h1) / ((a - b) * 12);

	h1 += res * (a - b) * 12;

	if (h1 >= h2) {
		if (h1 - 8 * a >= h2)
			res--;
		printf("%I64d\n", res);
	}
	h1 += (a - b) * 12;
	res++;
	if (h1 >= h2) {
		if (h1 - 8 * a >= h2)
			res--;
		printf("%I64d\n", res);
	}

	return 0;

}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main () {

	int a, b;
	int h1, h2;
	int i = 0;
	int j = 14;

	scanf("%d %d", &h1, &h2);
	scanf("%d %d", &a, &b);
// printf("%d %d\n", h1, h2);
// printf("%d %d\n", a, b);
	if (h1 + 8 * a >= h2) { //alcanca no 1 dia
		printf("0\n");
		return 0;
	}
	if (a <= b) {
		printf("-1\n");
		return 0;
	}
// 	printf("#\n");
	while (1) {
// 		printf("%d %d\n", h1, h2);

		if (10 <= j && j < 22) { //dia
			h1 += a * (22 - j);

			if (h1 >= h2) {
				if (h1 - 8 * a >= h2)
					i--;
				printf("%d\n", i);
				break;
			}
			i++;
			j = 22;
		} else { //noite
			h1 -= b * (j - 10);
			j = 10;
		}
	}

	return 0;

}

#include<stdio.h>
int main()
{
 int h1,h2;
 int a,b;
 scanf("%d %d",&h1,&h2);
 scanf("%d %d",&a,&b);

  if((h2-(h1+8*a))<1)
   printf("0\n");
   else if (a<=b)printf("-1\n");
   else {         int c=h2-h1-8*a;
	c/=12;
               printf("%d\n",c/(a-b)+1);
        }
  return 0;
}

#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
    int a,b,c,d,e,t,r=0,i;
    scanf("%d %d %d %d",&a,&b,&c,&d);

    i=8*c;
    e=b-a;
    t=12*(c-d);
    if(i>=e)
       r=0;
    else if(t<1)
        r=-1;
    else{
            r=(e/t);
        if((int)(e/t)==(e/t))
            r=r;
        else
            r++;
    }

    printf("%d",r);

return 0;
}

#include<stdio.h>
#define MOD 1000000007
typedef long long int llu;
llu mod(llu a) {
	return a>0?a:-1*a;
}
int main()
{
	llu h1,h2,a,b,i,ans=0;
	scanf("%I64d%I64d",&h1,&h2);
	scanf("%I64d%I64d",&a,&b);
	if(b>=a) {
		if( h2>8*a+h1 )
			ans = -1;
		else
			ans = 0;
	}
	else {
		if(h1+8*a>=h2) {
			ans = 0;
		}
		else {
			ans = (h2-(h1+8*a))/(12*(mod(b-a)));
			ans++;
		}
	}
	printf("%I64d",ans);
	return 0;
}

#include<stdio.h>
#define MOD 1000000007
typedef long long int llu;
int main()
{
	llu h1,h2,a,b,i,ans=0;
	scanf("%I64d%I64d",&h1,&h2);
	scanf("%I64d%I64d",&a,&b);
	if(b>=a) {
		if( h2>8*a+h1 )
			ans = -1;
		else
			ans = 0;
	}
	else {
		if(h1+8*a>=h2) {
			ans = 0;
		}
		else {
			ans = (h2-(h1+8*a))/(12*(b-a));
			ans++;
		}
	}
	printf("%I64d",ans);
	return 0;
}

#include<stdio.h>
int main(){
    int n,m,get,slip;
    while(scanf("%d%d%d%d",&n,&m,&get,&slip)!=EOF){
          if(n+8*get<m&&get<=slip)
            printf("-1\n");
            else{
                n=n+8*get;
                if(n>=m) {
                    printf("0\n");continue;
                }
                n=n-12*slip;
                if(n<0) n=0;
                for(int i=1;;i++){
                    n=n+get*12;
                    if(n>=m&&n-get*2>=m) {
                        printf("%d\n",i);
                       // printf("n=%d",n);
                        break;
                    }
                    n-=12*slip;
                    if(n<0) n=0;
                }
            }
          }
        return 0;
}

#include<stdio.h>
int main(){
    int n,m,get,slip;
    while(scanf("%d%d%d%d",&n,&m,&get,&slip)!=EOF){
          if(n+8*get>=m) {
            printf("0\n");continue;
          }
          else if(get<=slip){
            printf("-1\n");continue;
            }
          else printf("%d\n",(m-n-8*get+12*(get-slip)+1)/(12*(get-slip)));
          }
        return 0;
}

#include<stdio.h>
int main(){
    int n,m,get,slip;
    while(scanf("%d%d%d%d",&n,&m,&get,&slip)!=EOF){
          if(n+8*get<m&&get<=slip)
            printf("-1\n");
            else{
                n=n+8*get;
                if(n>=m) {
                    printf("0\n");continue;
                }
                n=n-12*slip;
                if(n<0) n=0;
                for(int i=1;;i++){
                    n=n+get*12;
                    if(n>=m&&n-get*2>=m) {
                        printf("%d\n",i);
                        printf("n=%d",n);
                        break;
                    }
                    n-=12*slip;
                    if(n<0) n=0;
                }
            }
          }
        return 0;
}

#include <stdio.h>
//#pragma warning (disable : 4996)
int main(int argc, char * argv[])
{
	long long int a, b; scanf("%lld %lld", &a, &b);
	long long int c, d; scanf("%lld %lld", &c, &d);

	a += c * 8;
	if (a >= b)
		printf("0\n");
	else if (c <= d)
		printf("-1\n");
	else
		printf("%lld\n", (b - a) / (c * 12 - d * 12) + 1);

	return 0;
}

#include <stdio.h>
//#pragma warning (disable : 4996)
int main(int argc, char * argv[])
{
	long long int a, b; scanf("%lld %lld", &a, &b);
	long long int c, d; scanf("%lld %lld", &c, &d);

	a += c * 8;
	if (a >= b)
		printf("0");
	else if (c <= d)
		printf("-1");
	else
		printf("%lld", (b - a) / ((c - d) * 12) + 1);

	return 0;
}

#include <stdio.h>
//#pragma warning (disable : 4996)
int main(int argc, char * argv[])
{
	long long int a, b; scanf("%lld %lld", &a, &b);
	long long int c, d; scanf("%lld %lld", &c, &d);

	a += c * 8;
	if (a >= b)
		printf("0");
	else if (c <= d)
		printf("-1");
	else
		printf("%lld", (((b - a) / ((c - d) * 12))) + 1);

	return 0;
}

#include <stdio.h>
//#pragma warning (disable : 4996)
int main(int argc, char * argv[])
{
	int a, b; scanf("%d %d", &a, &b);
	int c, d; scanf("%d %d", &c, &d);

	a += c * 8;
	if (a >= b)
		printf("0");
	else if (c <= d)
		printf("-1");
	else
		printf("%d", (((b - a) / ((c - d) * 12))) + 1);

	return 0;
}

#include <stdio.h>
//#pragma warning (disable : 4996)
int main(int argc, char * argv[])
{
	long long int a, b; scanf("%lld %lld", &a, &b);
	long long int c, d; scanf("%lld %lld", &c, &d);

	a += c * 8;
	if (a >= b)
		printf("0");
	else if (c <= d)
		printf("-1");
	else
		printf("%lld", ((b - a) / ((c - d) * 12)) + 1);

	return 0;
}

#include <stdio.h>
//#pragma warning (disable : 4996)
int main(int argc, char * argv[])
{
	int a, b; scanf("%d %d", &a, &b);
	int c, d; scanf("%d %d", &c, &d);
	int day = 0;
	a += 8 * c;
	while (1)
	{

		if (a >= b)
		{
			printf("%d", day);
			break;
		}
		if (b >= a)
		{
			printf("-1");
			break;
		}
		day++;
		a += 12 * c - 12 * d;

	}
	return 0;
}

# include <stdio.h>

int main ()
{
    int a,b,u,v;
    scanf("%d %d %d %d",&a,&b,&u,&v);
    int x=b-a;
    int z=12*v;
    int y=8*u;
    int w=12*u;
    if(u<v) {printf("-1"); return 0;}
    if(x<=(8*u)) {printf("0"); return 0;}
    else a=a+y-z;
    //if(a+y<0) printf("1") return 0;
    for(long int i=1;i<20000000000;i++){
        if(a<0 || a+w>=b)
            {printf("%ld",i);
                return 0;}
        else a=a+w-z;
    }
    printf("-1");
    return 0;
}

# include <stdio.h>

int main ()
{
    int a,b,u,v;
    scanf("%d %d %d %d",&a,&b,&u,&v);
    int x=b-a;
    int z=12*v;
    int y=8*u;
    int w=12*u;
    if(x<=(8*u)) {printf("0"); return 0;}
    if(u<v) {printf("-1"); return 0;}
    if(a+y-z < 0) {printf("1"); return 0;}
    else a=a+y-z;
    //if(a+y<0) printf("1") return 0;
    for(long int i=1;i<20000000000;i++){
        if(a<0 || a+w>=b)
            {printf("%ld",i);
                return 0;}
        else a=a+w-z;
    }
    printf("-1");
    return 0;
}

#include <stdio.h>

int main()
{
  int h1, h2, a, b, ans = 0;
  scanf("%d %d", &h1, &h2);
  scanf("%d %d", &a, &b);

  if (a <= b && h2 - h1 - a * 8 > 0) {
    printf("-1\n");
    return 0;
  }

  int dis = h2 - h1 - a * 8;
  if (dis <= 0) {
    printf("1\n");
    return 0;
  }
  ans += 1;

  while (dis > 0) {
    dis -= (a - b) * 12;
    if (dis <= 0) break;
    ans+= 1;
  }

  printf("%d\n", ans);
  return 0;
}

#include <stdio.h>

int main()
{
  int h1, h2, a, b, ans = 0;
  scanf("%d %d", &h1, &h2);
  scanf("%d %d", &a, &b);

  if (a <= b && h2 - h1 - a * 8 > 0) {
    printf("-1\n");
    return 0;
  }

  int dis = h2 - h1 - a * 8;
  if (dis <= 0) {
    printf("-1\n");
    return 0;
  }
  ans += 1;

  while (dis > 0) {
    dis -= (a - b) * 12;
    if (dis <= 0) break;
    ans+= 1;
  }

  printf("%d\n", ans);
  return 0;
}

#include<stdio.h>

int main()
{
	int a,b,h1,h2,i,j,k,count,sum;

	scanf("%d%d%d%d",&h1,&h2,&a,&b);

	h1=h2-h1;

	sum=a*(10-2);

	if(sum>=h1)
	{
		printf("0\n");
		return 0;
	}
	else
	{
		sum=sum-12*b;
		i=0;
		count=1;
		while(1)
		{
			sum=sum+4*a;

			if(sum<=h1&&sum+8*a>=h1)
			{
				printf("%d\n",count);
				break;
			}

			sum+=8*a;
			sum-=12*b;
			count++;
			if(count>=1000000)
			{
				printf("-1\n");
				break;
			}
		}
	}

	return 0;
}

#include<stdio.h>

int main()
{
	int a,b,h1,h2,i,j,k,count,sum;

	scanf("%d%d%d%d",&h1,&h2,&a,&b);

	h1=h2-h1;

	sum=a*(10-2);

	if(sum>=h1)
	{
		printf("0\n");
		return 0;
	}
	else
	{
		sum=sum-12*b;
		if(sum<=0)
			sum=0;

		i=0;
		count=1;
		while(1)
		{
			sum=sum+4*a;

			if(sum<=h1&&sum+8*a>=h1)
			{
				printf("%d\n",count);
				break;
			}

			sum+=8*a;
			sum-=12*b;
			if(sum<=0)
				sum=0;

			count++;
			if(count>=1000000)
			{
				printf("-1\n");
				break;
			}
		}
	}

	return 0;
}

#include<stdio.h>

int main()
{
	int a,b,h1,h2,i,j,k,count,sum;

	scanf("%d%d%d%d",&h1,&h2,&a,&b);

	h1=h2-h1;

	sum=a*(10-2);

	if(sum>=h1)
	{
		printf("0\n");
		return 0;
	}
	else if(a<=b)
	{
		printf("-1\n");
	}
	else
	{
		sum=sum-12*b;
		i=0;
		count=1;
		while(1)
		{
			sum=sum+4*a;

			if(sum<=h1&&sum+8*a>=h1)
			{
				printf("%d\n",count);
				break;
			}

			sum+=8*a;
			sum-=12*b;
			count++;
			if(count>=100000)
			{
				printf("-1\n");
				break;
			}
		}
	}

	return 0;
}

#include <stdio.h>

#define S_N 8
#define DN 12
#define D_S 4

int main() {

    int h1, h2;
    int a, b;

    scanf("%d%d", &h1, &h2);
    scanf("%d%d", &a, &b);

    h1 += S_N * a;
    if (h1 >= h2) {
        printf("0");
        return 0;
    }
    if (a <= b) {
        printf("-1");
        return 0;
    }
    printf("%d", (h2 - h1) / ((a - b) * DN) + 1);
    return 0;

}

#include<stdio.h>
int main()
{
    long long int x,y,a,b,i,l=0;
    scanf("%lld %lld",&x,&y);
    scanf("%lld %lld",&a,&b);
    if(8*a+x>=y)
    {printf("0");}
    else
    {if(b>=a)
     {printf("-1");}
     else
     {x=x+8*a-12*b;
      i=0;
      while(x<y)
      { i++;
        x=x+(12*a-12*b);
      }

      printf("%lld",i-1);
     }
    }
    return 0;
}

#include<stdio.h>
int main()
{
    long long int x,y,a,b,i,l=0;
    scanf("%lld %lld",&x,&y);
    scanf("%lld %lld",&a,&b);
    if(8*a+x>=y)
    {printf("0");}
    else
    {if(b>=a)
     {printf("-1");}
     else
     {x=x+8*a-12*b;
      i=0;
      while(x<y)
      { i++;
        x=x+(12*a);
        if(x>=y)
        {printf("%lld",i);}
        x=x-12*b;
      }
     }
    }
    return 0;
}

#include<stdio.h>
int main()
{
    long long int x,y,a,b,i,l=0;
    scanf("%lld %lld",&x,&y);
    scanf("%lld %lld",&a,&b);
    if(8*a+x>=y)
    {printf("0");}
    else
    {x=x+8*a-12*b;
     for(i=4;i<=12;i++)
     {if(x+i*a>=y)
      {l++;
       break;
      }
     }
     if(l==0)
     {printf("-1");}
     else
     {printf("1");}
    }
    return 0;
}

#include<stdio.h>
int main ()
{
	int h1,h2,a,b;
	scanf("%d %d",&h1,&h2);
	scanf("%d %d",&a,&b);
	if(a<b) printf("%d",-1);
	else if(h2-h1<8*a) printf("%d",0);
	else{
	h1=h1+a*8-b*12;
	int count=1;
	while(h1+12*a<h2){
		h1=a*12+h1-b*12;
		if(h1<0) break;
		count++;
	}
	printf("%d",count);}
	return 0;
}

#include<stdio.h>
int main ()
{
	int h1,h2,a,b;
	scanf("%d %d",&h1,&h2);
	scanf("%d %d",&a,&b);
	if(a<b) printf("%d",-1);
	else if(h2-h1<8*a) printf("%d",0);
	else{
	h1=h1+a*8-b*12;
	int count=1;
	while(h1+12*a<h2){
		h1=a*12+h1-b*12;
		count++;
	}
	printf("%d",count);}
	return 0;
}

#include<stdio.h>
int main ()
{
	int h1,h2,a,b;
	scanf("%d %d",&h1,&h2);
	scanf("%d %d",&a,&b);
	if(h2-h1<8*a) printf("%d",0);
	else if(a<b) printf("%d",-1);
	else{
	h1=h1+a*8-b*12;
	int count=1;
	while(h1+12*a<h2){
		h1=a*12+h1-b*12;
		if(h1<0) break;
		count++;
	}
	printf("%d",count);}
	return 0;
}

#include<stdio.h>
int main ()
{
	int h1,h2,a,b;
	scanf("%d %d",&h1,&h2);
	scanf("%d %d",&a,&b);
	if(h2-h1<8*a) printf("%d",0);
	else if(a<=b) printf("%d",-1);
	else{
	h1=h1+a*8-b*12;
	int count=1;
	while(h1+12*a<h2){
		h1=a*12+h1-b*12;
		count++;
	}
	printf("%d",count);}
	return 0;
}

# include <stdio.h>

int main ()
{
    int a,b,u,v;
    scanf("%d %d %d %d",&a,&b,&u,&v);
    int x=b-a;
    int z=12*v;
    int y=8*u;
    int w=12*u;
    if(u<v) {printf("-1"); return 0;}
    if(x<=(8*u)) {printf("0"); return 0;}
    else a=a+y-z;
    //if(a+y<0) printf("1") return 0;
    for(int i=1;i<1000;i++){
        if(a<0 || a+w>=b)
            {printf("%d",i);
                return 0;}
        else a=a+w-z;
    }
    printf("-1");
    return 0;
}

# include <stdio.h>

int main ()
{
    int a,b,u,v;
    scanf("%d %d %d %d",&a,&b,&u,&v);
    int x=b-a;
    int z=12*v;
    int y=8*u;
    int w=12*u;
    if(u<v) {printf("-1"); return 0;}
    if(x<=(8*u)) {printf("0"); return 0;}
    else a=a+y-z;
    //if(a+y<0) printf("1") return 0;
    for(int i=1;i<1000;i++){
        if(a<0 || a+w>=b)
            {printf("%d",i);
                return 0;}
        else a=a+w-z;
    }

    return 0;
}

# include <stdio.h>

int main ()
{
    int a,b,u,v;
    scanf("%d %d %d %d",&a,&b,&u,&v);
    int x=b-a;
    int z=12*v;
    int y=8*u;
    int w=12*u;
    if(x<=(8*u)) {printf("0"); return 0;}
    if(u<v) {printf("-1"); return 0;}

    else a=a+y-z;
    //if(a+y<0) printf("1") return 0;
    for(long int i=1;i<20000000000;i++){
        if(a<0 || a+w>=b)
            {printf("%ld",i);
                return 0;}
        else a=a+w-z;
    }
    printf("-1");
    return 0;
}

#include <stdio.h>
#include <string.h>
#include <stdbool.h>

#define clr(ar) memset(ar, 0, sizeof(ar))
#define read() freopen("lol.txt", "r", stdin)

int main(){
    int i, j, k, l, x, h1, h2, a, b;

    while (scanf("%d %d %d %d", &h1, &h2, &a, &b) != EOF){
        int hour = 14, days = 0, lim = 1e8;

        while (h1 < h2 && lim--){
            if (hour >= 10 && hour < 22) h1 += a;
            else h1 -= b;
            hour++;
            if (hour == 24) hour = 0;
            if (hour == 10) days++;
        }

        if (lim <= 0) days = -1;
        printf("%d\n", days);
    }
    return 0;
}

#include<stdio.h>
#include<string.h>
int main()
{
	int s,e;
	int u,d;
	int len;
	int day=0,flag=1;
	scanf("%d %d",&s,&e);
	scanf("%d %d",&u,&d);
	len=e-s;
	if(u*6>=len) printf("0\n");
	else if(u<=d) printf("-1\n");
	else
	{
		day=0;flag=1;
		len=len-u*6;
		while(flag==1)
		{
			len-=12*u;
			day++;
			if(len<=0) flag=0;
			len+=12*d;
		}
		printf("%d\n",day);
	}
}

#include <stdio.h>

/*
 * http://codeforces.com/problemset/problem/652/A
 */
int main()
{
    int hc = 0, ha = 0;
    scanf("%d %d", &hc, &ha);

    int a = 0, b = 0, d = 0;
    scanf("%d %d", &a, &b);

    hc += 8 * a;

    if (hc < ha && a <= b) {
        printf("-1\n");

        return 0;
    }

    while (hc <= ha) {
        hc += a * 12 - b * 12;
        d += 1;
    }

    printf("%d\n", d);

    return 0;
}

#include<stdio.h>
#include<stdbool.h>

int main(){
    long long int h1,h2,a,b;
     scanf("%lld %lld",&h1,&h2);
     scanf("%lld %lld",&a,&b);
     int i;
     long long int dist=h1;
     bool day=1,first=1,sec=1;
     int count=0;
      while(1){
           if(dist>=h2||(!sec&&dist<0))
            break;
           if(day&&first){
            dist+=(a*8);
            day=0;
            first=0;
           }
           else if(!day){
            dist-=(b*12);
            count++;
            day=1;
           }
           else if(!first){
               dist+=(a*12);
               day=0;
               sec=0;
           }

      }
      if(dist>=h2)
      printf("%d",count);
      else
      printf("-1");
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    long long h1,h2,a,b,h,step,days;

    scanf("%lld %lld",&h1,&h2);
    scanf("%lld %lld",&a,&b);

    if(b>a && (8*a)<(h2-h1))
        printf("-1");

    else if(8*a >= h2-h1)
        printf("0");

    else
    {
        h = h2 - (h1 + 8*a);
        step = 12*(a-b);
        days = ceil((double)h/step);
        printf("%lld",days);
    }

    return 0;
}

#include<stdio.h>
int main(){
    int a,b,c,d,e,f,g;
    int first,second;
    int up,down;
    scanf("%d%d",&first,&second);
    scanf("%d%d",&up,&down);
    if(((first + 8*up) - (12 * down) + 4*up) <= first && (((8*up)+first) <= second)){
    printf("-1");
    return 0;}
    if(up == down && (((8*up)+first) <= second)){
    printf("-1");
    return 0;
    }
    int cnt=0,i;
    if(first>=second){
    printf("0");
    return 0;}
    while(1){
    for(i=0;i<8;i++){
    first+=up;
    if(first>=second){
    printf("%d",cnt);
    return 0;
    }}
    for(i=0;i<12;i++){
    first-=down;
    if(first>=second){
    printf("%d",cnt);
    return 0;
    }}
    cnt++;
    for(i=0;i<4;i++){
    first+=up;
    if(first>=second){
    printf("%d",cnt);
    return 0;
    }}
    }
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int h,h1,h2,a,b,up,down,reach,des;
    int k=-1;
    scanf("%d%d",&h1,&h2);
    scanf("%d%d",&a,&b);
   h=h2-h1;
      up=12*a;
   down = 12*b;
   if(a==b)
   {    k=0;
       printf("%d",k);
       return 0;
   }

    reach=up-down;
     k=h/reach;

    if(b>a)
    {   k=-1;
        printf("%d",k);
        return 0;
    }

    else if((reach>h) ||  (des<0))
    {   k=0;
        printf("%d",k);
         return 0;
    }

    if(k>1)
        k=1;
      printf("%d",k);

    return 0;
}

#include<stdio.h>

int cat(int a,int b,int h1, int h2,int d)
{   int pos=0,k=0;
       pos=(a*8)+h1;
    if(pos>=h2)
    {
        k=d;
        printf("%d",k);
        return 0;
    }
    d++;
    pos-=(b*12);
    pos=pos+a*4;
     if(pos>=h2)
    {
        k=d;
        printf("%d",k);
        return 0;
    }
    cat(a,b,pos,h2,d);
}

int main()
{
    int a,b,h1,h2,d=0;
    scanf("%d%d",&h1,&h2);
    scanf("%d%d",&a,&b);
	if(a==b)
	{
	printf("%d",d);
	return 0;
	}
	if(a<b)
	{
	d=-1;
	printf("%d",d);
	return 0;

	}

cat(a,b,h1,h2,d);
return 0;
}

#include<stdio.h>
int main()
{
	int e;
	float a,g,b,c,d;
	scanf("%f%f%f%f",&a,&b,&c,&d);
	if(a+8*c>=b || a==b)
	{
		printf("0\n");
		goto jump;
	}
	else if(c<d || (c==d && a!=b))
	{
		printf("-1\n");
		goto jump;
	}
	else
	{
		e=2*(b-a-8*c)/(c-d);
		g=2*(b-a-8*c)/(c-d);
	}
	int f=e%24;
	if(f<=2 && g<=2)
	{
		printf("%d\n",e/24);
	}
	else
		printf("%d\n",e/24+1);
	jump:
	return 0;
}

#include<stdio.h>
int main()
{
	int e;
	float a,g,b,c,d;
	scanf("%f%f%f%f",&a,&b,&c,&d);
	if(a+8*c>=b || a==b)
	{
		printf("0\n");
		goto jump;
	}
	else if(c<d || (c==d && a!=b))
	{
		printf("-1\n");
		goto jump;
	}
	else
	{
		e=2*(b-a-8*c)/(c-d);
		g=2*(b-a-8*c)/(c-d);
	}
	int f=e%24;
	if(f!=0)
	printf("%d\n",e/24+1);
else printf("%d\n",e/24);
	jump:
	return 0;
}

#include<stdio.h>
int main()
{
	int a,b,c,d,e;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	if(a+8*c>=b || a==b)
	{
		printf("0\n");
		goto jump;
	}
	else if(c<d || (c==d && a!=b))
	{
		printf("-1\n");
		goto jump;
	}
	else
	{
		e=2*(b-a-8*c)/(c-d);
	}
	int f=e%24;
	if(f<=2)
	{
		printf("%d\n",e/24);
	}
	else
		printf("%d\n",e/24+1);
	jump:
	return 0;
}

#include<stdio.h>
int main()
{
	int e;
	float a,g,b,c,d;
	scanf("%f%f%f%f",&a,&b,&c,&d);
	if(a+8*c>=b || a==b)
	{
		printf("0\n");
		goto jump;
	}
	else if(c<d || (c==d && a!=b))
	{
		printf("-1\n");
		goto jump;
	}
	else
	{
		e=2*(b-a-8*c)/(c-d);
		g=2*(b-a-8*c)/(c-d);
	}
	int f=e%24;
	if(f==0 || g<=2)
	printf("%d\n",e/24);
else if(f!=0)
	printf("%d\n",e/24+1);
	jump:
	return 0;
}