program massiv;
var i,j,kol:longint;
a:array[1..6,1..8]of longint;
begin
for i:=1 to 6 do
for j:=1 to 8 do
read(a[i,j]);
for i:=1 to 6 do
for j:=1 to 8 do
if a[i,j]=0 then kol:=kol+1;
writeln(kol);
end.
#include<iostream>
using namespace std;
int main(){
int l,v1,v2,t;
cin>>l>>v1>>v2>>t;
int x1 = (t * v1)%l,x2 = (-t*v2)%l;
if(x1<0) x1=l-x1;
if(x2<0) x2=l+x2;
cout<<min(abs(x1-x2),abs(l-x1-x2));
}