  Two fundamental problems of distributed computing are Gathering and Arbitrary
pattern formation (\textsc{Apf}). These two tasks are different in nature as in
gathering robots meet at a point but in \textsc{Apf} robots form a fixed
pattern in distinct positions.
  In most of the current literature on swarm robot algorithms, it is assumed
that all robots in the system perform one single task together. Two teams of
oblivious robots deployed in the same system and different teams of robots
performing two different works simultaneously where no robot knows the team of
another robot is a new concept in the literature introduced by Bhagat et al.
[ICDCN'2020].
  In this work, a swarm of silent and oblivious robots are deployed on an
infinite grid under an asynchronous scheduler. The robots do not have access to
any global coordinates. Some of the robots are given input of an arbitrary but
unique pattern. The set of robots with the given pattern is assigned with the
task of forming the given pattern on the grid. The remaining robots are
assigned with the task of gathering to a vertex of the grid (not fixed from
earlier and not any point where a robot that is forming a pattern terminates).
Each robot knows to which team it belongs, but can not recognize the team of
another robot. Considering weak multiplicity detection, a distributed algorithm
is presented in this paper which leads the robots with the input pattern into
forming it and other robots into gathering on a vertex of the grid on which no
other robot forming the pattern, terminates.
