#include<bits/stdc++.h>
using namespace std;
int fx[4][2]={{-1,0},{1,0},{0,-1},{0,1}};
char a[30][30];
int d[30][30];
int n,m,s1,s2,e1,e2;
void dfs(int x,int y,int dep){
d[x][y] = dep;
int tx,ty;
for(int i = 0;i < 4;i++){
tx = x + fx[i][0];
ty = y + fx[i][1];
if(tx>=1&&tx<=n&&ty>=1&&ty<=m&&a[tx][ty]!='#'){
if(a[tx][ty]=='x' && dep+2<d[tx][ty]) dfs(tx,ty,dep+2);
else if(a[tx][ty]!='x' && dep+1<d[tx][ty]) dfs(tx,ty,dep+1);
}
}
}
int main(){
cin>>n>>m;
for(int i = 1;i <= n;i++){
for(int j = 1;j <= m;j++){
cin>>a[i][j];
d[i][j] = INT_MAX;
if(a[i][j]=='a'){
e1 = i;
e2 = j;
}else if(a[i][j] == 'r'){
s1 = i;
s2 = j;
}
}
}
dfs(s1,s2,0);
if(d[e1][e2] == INT_MAX) cout<<"Impossible";
else cout<<d[e1][e2];
return 0;
}
/**************************************************************
Problem: 1901
User: liyunshuo
Language: C++
Result: Accepted
Time:12 ms
Memory:2076 kb
****************************************************************/