#include <cstdio>
#include <iostream>
#include <utility>
#include <iomanip>
#include <cmath>
#include <algorithm>
using namespace std;

typedef pair<double,double> ii;

double ccw(ii a,ii b,ii c){
    return (b.first-a.first)*(c.second-a.second)-(b.second-a.second)*(c.first-a.first);
}

bool check(ii a,ii b,ii c,ii d){
    if(ccw(a,b,c)*ccw(a,b,d)<=0 && ccw(c,d,b)*ccw(c,d,a)<=0)return 1;
    //cout<<ccw(a,b,c)*ccw(a,b,d)<<" "<<ccw(c,d,b)*ccw(c,d,a)<<endl;
    return 0;
}

double dist(ii a,ii b){
    return sqrt((b.first-a.first)*(b.first-a.first)+(b.second-a.second)*(b.second-a.second));
}

int a,b,c;
ii p1,p2;
int main(){
    scanf("%d %d %d",&a,&b,&c);
    getchar();
    cin>>p1.first>>p1.second>>p2.first>>p2.second;

    if(p1.first==p2.first){
        cout<<fixed<<setprecision(10)<<(max(p1.second,p2.second)-min(p1.second,p2.second))<<endl;
    }
    else if(p1.second==p2.second){
        cout<<fixed<<setprecision(10)<<(max(p1.first,p2.first)-min(p1.first,p2.first))<<endl;
    }
    else{
        ii l1,l2;
        l1.first=min(p1.first,p2.first)-1;
        l1.second=((-a)*l1.first-c)/b;
        l2.first=max(p1.first,p2.first)+1;
        l2.second=((-a)*l2.first-c)/b;
        //cout<<a<<" "<<b<<" "<<c<<endl;
        //cout<<l1.first<<" "<<l1.second<<" "<<l2.first<<" "<<l2.second<<endl;

        bool ok=1;
        int cc=0;
        if(check(l1,l2,p1,ii(p1.first,p2.second)))cc++;
        if(check(l1,l2,p1,ii(p2.first,p1.second)))cc++;
        if(cc==2)ok=0;
        if(check(l1,l2,p2,ii(p1.first,p2.second)))cc++;
        if(check(l1,l2,p2,ii(p2.first,p1.second)))cc++;

        cout<<cc<<endl;

        double ans=abs(p1.first-p2.first)+abs(p1.second-p2.second);
        if((cc==2&& ok)|| (cc==4 && (a*p1.first+b*p1.second+c==0)) || (cc==3 &&((a*p1.first+b*p1.second+c==0)||(a*p2.first+b*p2.second+c==0)))){
            ii s1,s2;
            if(check(l1,l2,p1,ii(p1.first,p2.second))){
                s1.first=p1.first;
                s1.second=((-a)*p1.first-c)/b;
            }
            else{
                s1.second=p1.second;
                s1.first=((-b)*p1.second-c)/a;
            }

            if(check(l1,l2,p2,ii(p1.first,p2.second))){
                s2.second=p2.second;
                s2.first=((-b)*p2.second-c)/a;
            }
            else{
                s2.first=p2.first;
                s2.second=((-a)*p2.first-c)/b;
            }
            ans=min(ans,dist(p1,s1)+dist(s1,s2)+dist(s2,p2));
            ans=min(ans,dist(p1,s2)+dist(s1,s2)+dist(s1,p2));
        }
        cout<<fixed<<setprecision(10)<<ans<<endl;
    }
}


#include <cstdio>
#include <iostream>
#include <utility>
#include <iomanip>
#include <cmath>
#include <algorithm>
using namespace std;

typedef pair<double,double> ii;

double ccw(ii a,ii b,ii c){
    return (b.first-a.first)*(c.second-a.second)-(b.second-a.second)*(c.first-a.first);
}

bool check(ii a,ii b,ii c,ii d){
    if(ccw(a,b,c)*ccw(a,b,d)<=0 && ccw(c,d,b)*ccw(c,d,a)<=0)return 1;
    //cout<<ccw(a,b,c)*ccw(a,b,d)<<" "<<ccw(c,d,b)*ccw(c,d,a)<<endl;
    return 0;
}

double dist(ii a,ii b){
    return sqrt((b.first-a.first)*(b.first-a.first)+(b.second-a.second)*(b.second-a.second));
}

int a,b,c;
ii p1,p2;
int main(){
    scanf("%d %d %d",&a,&b,&c);
    getchar();
    cin>>p1.first>>p1.second>>p2.first>>p2.second;

    if(p1.first==p2.first){
        cout<<fixed<<setprecision(10)<<(max(p1.second,p2.second)-min(p1.second,p2.second))<<endl;
    }
    else if(p1.second==p2.second){
        cout<<fixed<<setprecision(10)<<(max(p1.first,p2.first)-min(p1.first,p2.first))<<endl;
    }
    else{
        ii l1,l2;
        l1.first=min(p1.first,p2.first)-1;
        l1.second=((-a)*l1.first-c)/b;
        l2.first=max(p1.first,p2.first)+1;
        l2.second=((-a)*l2.first-c)/b;
        //cout<<a<<" "<<b<<" "<<c<<endl;
        //cout<<l1.first<<" "<<l1.second<<" "<<l2.first<<" "<<l2.second<<endl;

        bool ok=1;
        int cc=0;
        if(check(l1,l2,p1,ii(p1.first,p2.second)))cc++;
        if(check(l1,l2,p1,ii(p2.first,p1.second)))cc++;
        if(cc==2)ok=0;
        if(check(l1,l2,p2,ii(p1.first,p2.second)))cc++;
        if(check(l1,l2,p2,ii(p2.first,p1.second)))cc++;

        //cout<<cc<<endl;

        double ans=abs(p1.first-p2.first)+abs(p1.second-p2.second);
        if((cc==2&& ok)|| (cc==4 && (a*p1.first+b*p1.second+c==0))){
            ii s1,s2;
            if(check(l1,l2,p1,ii(p1.first,p2.second))){
                s1.first=p1.first;
                s1.second=((-a)*p1.first-c)/b;
            }
            else{
                s1.second=p1.second;
                s1.first=((-b)*p1.second-c)/a;
            }

            if(check(l1,l2,p2,ii(p1.first,p2.second))){
                s2.second=p2.second;
                s2.first=((-b)*p2.second-c)/a;
            }
            else{
                s2.first=p2.first;
                s2.second=((-a)*p2.first-c)/b;
            }
            ans=min(ans,dist(p1,s1)+dist(s1,s2)+dist(s2,p2));
            ans=min(ans,dist(p1,s2)+dist(s1,s2)+dist(s1,p2));
        }
        cout<<fixed<<setprecision(10)<<ans<<endl;
    }
}


#include <cstdio>
#include <iostream>
#include <utility>
#include <iomanip>
#include <cmath>
#include <algorithm>
using namespace std;

typedef pair<double,double> ii;

double ccw(ii a,ii b,ii c){
    return (b.first-a.first)*(c.second-a.second)-(b.second-a.second)*(c.first-a.first);
}

bool check(ii a,ii b,ii c,ii d){
    if(ccw(a,b,c)*ccw(a,b,d)<=0 && ccw(c,d,b)*ccw(c,d,a)<=0)return 1;
    //cout<<ccw(a,b,c)*ccw(a,b,d)<<" "<<ccw(c,d,b)*ccw(c,d,a)<<endl;
    return 0;
}

double dist(ii a,ii b){
    return sqrt((b.first-a.first)*(b.first-a.first)+(b.second-a.second)*(b.second-a.second));
}

int a,b,c;
ii p1,p2;
int main(){
    scanf("%d %d %d",&a,&b,&c);
    getchar();
    cin>>p1.first>>p1.second>>p2.first>>p2.second;

    if(p1.first==p2.first){
        cout<<fixed<<setprecision(10)<<(max(p1.second,p2.second)-min(p1.second,p2.second))<<endl;
    }
    else if(p1.second==p2.second){
        cout<<fixed<<setprecision(10)<<(max(p1.first,p2.first)-min(p1.first,p2.first))<<endl;
    }
    else{
        ii l1,l2;
        l1.first=min(p1.first,p2.first)-1;
        l1.second=((-a)*l1.first-c)/b;
        l2.first=max(p1.first,p2.first)+1;
        l2.second=((-a)*l2.first-c)/b;
        //cout<<a<<" "<<b<<" "<<c<<endl;
        //cout<<l1.first<<" "<<l1.second<<" "<<l2.first<<" "<<l2.second<<endl;

        bool ok=1;
        int cc=0;
        if(check(l1,l2,p1,ii(p1.first,p2.second)))cc++;
        if(check(l1,l2,p1,ii(p2.first,p1.second)))cc++;
        if(cc==2)ok=0;
        if(check(l1,l2,p2,ii(p1.first,p2.second)))cc++;
        if(check(l1,l2,p2,ii(p2.first,p1.second)))cc++;

        //cout<<cc<<endl;

        double ans=abs(p1.first-p2.first)+abs(p1.second-p2.second);
        if((cc==2&& ok)|| (cc==4 && (a*p1.first+b*p1.second+c==0)) || (cc==3 &&((a*p1.first+b*p1.second+c==0)||(a*p2.first+b*p2.second+c==0)))){
            ii s1,s2;
            if(check(l1,l2,p1,ii(p1.first,p2.second))){
                s1.first=p1.first;
                s1.second=((-a)*p1.first-c)/b;
            }
            else{
                s1.second=p1.second;
                s1.first=((-b)*p1.second-c)/a;
            }

            if(check(l1,l2,p2,ii(p1.first,p2.second))){
                s2.second=p2.second;
                s2.first=((-b)*p2.second-c)/a;
            }
            else{
                s2.first=p2.first;
                s2.second=((-a)*p2.first-c)/b;
            }
            ans=min(ans,dist(p1,s1)+dist(s1,s2)+dist(s2,p2));
            ans=min(ans,dist(p1,s2)+dist(s1,s2)+dist(s1,p2));
        }
        cout<<fixed<<setprecision(10)<<ans<<endl;
    }
}


#include <cstdio>
#include <iostream>
#include <utility>
#include <iomanip>
#include <cmath>
#include <algorithm>
using namespace std;

typedef pair<double,double> ii;

double ccw(ii a,ii b,ii c){
    return (b.first-a.first)*(c.second-a.second)-(b.second-a.second)*(c.first-a.first);
}

bool check(ii a,ii b,ii c,ii d){
    if(ccw(a,b,c)*ccw(a,b,d)<=0 && ccw(c,d,b)*ccw(c,d,a)<=0)return 1;
    //cout<<ccw(a,b,c)*ccw(a,b,d)<<" "<<ccw(c,d,b)*ccw(c,d,a)<<endl;
    return 0;
}

double dist(ii a,ii b){
    return sqrt((b.first-a.first)*(b.first-a.first)+(b.second-a.second)*(b.second-a.second));
}

int a,b,c;
ii p1,p2;
int main(){
    scanf("%d %d %d",&a,&b,&c);
    getchar();
    cin>>p1.first>>p1.second>>p2.first>>p2.second;

    if(p1.first==p2.first){
        cout<<fixed<<setprecision(10)<<(max(p1.second,p2.second)-min(p1.second,p2.second))<<endl;
    }
    else if(p1.second==p2.second){
        cout<<fixed<<setprecision(10)<<(max(p1.first,p2.first)-min(p1.first,p2.first))<<endl;
    }
    else{
        ii l1,l2;
        l1.first=min(p1.first,p2.first)-1;
        l1.second=((-a)*l1.first-c)/b;
        l2.first=max(p1.first,p2.first)+1;
        l2.second=((-a)*l2.first-c)/b;
        //cout<<a<<" "<<b<<" "<<c<<endl;
        //cout<<l1.first<<" "<<l1.second<<" "<<l2.first<<" "<<l2.second<<endl;

        bool ok=1;
        int cc=0;
        if(check(l1,l2,p1,ii(p1.first,p2.second)))cc++;
        if(check(l1,l2,p1,ii(p2.first,p1.second)))cc++;
        if(cc==2)ok=0;
        if(check(l1,l2,p2,ii(p1.first,p2.second)))cc++;
        if(check(l1,l2,p2,ii(p2.first,p1.second)))cc++;

        //cout<<cc<<endl;

        double ans;
        if((cc==2&& ok)|| (cc==4 && (a*p1.first+b*p1.second+c==0))){
            ii s1,s2;
            if(check(l1,l2,p1,ii(p1.first,p2.second))){
                s1.first=p1.first;
                s1.second=((-a)*p1.first-c)/b;
            }
            else{
                s1.second=p1.second;
                s1.first=((-b)*p1.second-c)/a;
            }

            if(check(l1,l2,p2,ii(p1.first,p2.second))){
                s2.second=p2.second;
                s2.first=((-b)*p2.second-c)/a;
            }
            else{
                s2.first=p2.first;
                s2.second=((-a)*p2.first-c)/b;
            }
            ans=dist(p1,s1)+dist(s1,s2)+dist(s2,p2);
        }
        else{
            ans=abs(p1.first-p2.first)+abs(p1.second-p2.second);
        }
        cout<<fixed<<setprecision(10)<<ans<<endl;
    }
}


#include <bits/stdc++.h>
# define M_PI           3.14159265358979323846  /* pi */
# define EPS            1e-9
#define ll  long long int

using namespace std;
struct point {
    long double x, y;
    point(){x = 0.0, y = 0.0;}
    point(double _x, double _y){x = _x, y = _y;}
    bool operator < (point other) const {
    if (fabs(x - other.x) > EPS)
    return x < other.x;
    return y < other.y; }
    };

struct line {
    long double a, b, c;
    line(point p1, point p2){
        if(fabs(p1.x - p2.x) < EPS){
        a = 1.0; b = 0.0; c = -p1.x;
        }
        else{
            a = -(double)(p1.y - p2.y)/(p1.x - p2.x);
            b = 1.0;
            c = -(double)( a * p1.x ) - p1.y;
        }
    }
    line(){
    }
    };

bool areParallel(line l1, line l2){
return (fabs(l1.a - l2.a) < EPS) && (fabs(l1.b-l2.b) < EPS);
}
bool areSame(line l1, line l2){
return (areParallel(l1, l2)) && (fabs(l1.c-l2.c) < EPS);
}

bool areIntersect(line l1, line l2, point &p){
    if(areParallel(l1, l2)) return false;
    p.x = (l1.c*l2.b - l1.b*l2.c) / (l2.a*l1.b - l2.b*l1.a);
    if(fabs(l1.b) > EPS) p.y = -(l1.a*p.x + l1.c);
    else p.y = -(l2.a*p.x + l2.c);
    return true;
}

double dist(point a, point b){
    return sqrt( (a.x-b.x)*(a.x-b.x) + ((a.y-b.y)*(a.y-b.y)));
}

vector<string> split(const string& s, char delimiter)
{
   vector<string> tokens;
   string token;
   istringstream tokenStream(s);
   while (getline(tokenStream, token, delimiter))
   {
      tokens.push_back(token);
   }
   return tokens;
}

struct vec {
    double x, y;
    vec(double _x, double _y) : x(_x), y(_y) {}
};
vec toVec(point a, point b) {
    return vec(b.x - a.x, b.y - a.y);
}
vec scale(vec v, double s) {
    return vec(v.x * s, v.y * s);
}
point translate(point p, vec v) {
    return point(p.x + v.x , p.y + v.y);
}
double dot(vec a, vec b) {
    return (a.x * b.x + a.y * b.y);
}
double cross(vec a, vec b) {
    return a.x * b.y - a.y * b.x;
}
double norm_sq(vec v) {
    return v.x * v.x + v.y * v.y;
}
point rot(point p, double theta) {
    double rad = (theta*M_PI)/180.0; // multiply theta with PI / 180.0
    point p2(p.x * cos(rad) - p.y * sin(rad), p.x * sin(rad) + p.y * cos(rad));
    if(abs(p2.x) < EPS) p2.x = 0.0;
    if(abs(p2.y) < EPS) p2.y = 0.0;
    return p2;
}
double angle(point a, point o, point b) { // returns angle aob in rad
vec oa = toVec(o, a), ob = toVec(o, b);
return acos(dot(oa, ob) / sqrt(norm_sq(oa) * norm_sq(ob))); }

double distToLine(point p, point a, point b, point &c) {
    // formula: c = a + u * ab
    vec ap = toVec(a, p), ab = toVec(a, b);
    double u = dot(ap, ab) / norm_sq(ab);
    c = translate(a, scale(ab, u)); // translate a to c
    return dist(p, c);
}

double distToLineSegment(point p, point a, point b, point &c) {
    vec ap = toVec(a, p), ab = toVec(a, b);
    double u = dot(ap, ab) / norm_sq(ab);
    if (u < 0.0) { c = point(a.x, a.y); // closer to a
    return dist(p, a); } // Euclidean distance between p and a
    if (u > 1.0) { c = point(b.x, b.y); // closer to b
    return dist(p, b); } // Euclidean distance between p and b
    return distToLine(p, a, b, c);
}

int main(){
    cout.precision(20);

    line diag;
    cin >> diag.a >> diag.b >> diag.c;
    point A, B;
    cin >> A.x >> A.y;
    cin >> B.x >> B.y;

    double d0 = abs( A.x - B.x ) + abs( A.y - B.y );

    /** vertical line **/
    if(diag.b == 0){
        point newA( -diag.c / diag.a , A.y),
              newB( -diag.c / diag.a , B.y);
//        cout << newA.x << " " << newA.y << endl;
//        cout << newB.x << " " << newB.y << endl;
        double d1 = dist(newA, newB) + dist(A, newA) + dist(B, newB);
//        cout << d1 << endl;
        return cout << min(d0, d1), 0;
    }
    if(diag.a == 0){
        point newA(A.x, -diag.c / diag.b ),
              newB(B.x, -diag.c / diag.b );
        double d1 = dist(newA, newB) + dist(A, newA) + dist(B, newB);
        return cout << min(d0, d1), 0;
    }

    /** from x to x **/
    point newA(A.x, ( - diag.a * A.x - diag.c) / diag.b ),
          newB(B.x, ( - diag.a * B.x - diag.c) / diag.b );
    double d1 = dist(newA, newB) + dist(A, newA) + dist(B, newB);

    /** from y to y **/
    newA = point (( - diag.b * A.y - diag.c) / diag.a, A.y ),
    newB = point (( - diag.b * B.y - diag.c) / diag.a, B.y );
    double d2 = dist(newA, newB) + dist(A, newA) + dist(B, newB);

    /** from x to y **/
    newA = point (A.x, ( - diag.a * A.x - diag.c) / diag.b ),
    newB = point (( - diag.b * B.y - diag.c) / diag.a, B.y );
    double d3 = dist(newA, newB) + dist(A, newA) + dist(B, newB);

    /** from y to x **/
    newA = point (( - diag.b * A.y - diag.c) / diag.a, A.y ),
    newB = point (B.x, ( - diag.a * B.x - diag.c) / diag.b );
    double d4 = dist(newA, newB) + dist(A, newA) + dist(B, newB);

    d0 = min( d0, min( d1, min( d2, min( d3, d4 ) ) ) );

    cout << fixed << setprecision(10) << d0;

}


#include <bits/stdc++.h>
# define M_PI           3.14159265358979323846  /* pi */
# define EPS            1e-9
#define ll  long long int

using namespace std;
struct point {
    double x, y;
    point(){x = 0.0, y = 0.0;}
    point(double _x, double _y){x = _x, y = _y;}
    bool operator < (point other) const {
    if (fabs(x - other.x) > EPS)
    return x < other.x;
    return y < other.y; }
    };

struct line {
    double a, b, c;
    line(point p1, point p2){
        if(fabs(p1.x - p2.x) < EPS){
        a = 1.0; b = 0.0; c = -p1.x;
        }
        else{
            a = -(double)(p1.y - p2.y)/(p1.x - p2.x);
            b = 1.0;
            c = -(double)( a * p1.x ) - p1.y;
        }
    }
    line(){
    }
    };

bool areParallel(line l1, line l2){
return (fabs(l1.a - l2.a) < EPS) && (fabs(l1.b-l2.b) < EPS);
}
bool areSame(line l1, line l2){
return (areParallel(l1, l2)) && (fabs(l1.c-l2.c) < EPS);
}

bool areIntersect(line l1, line l2, point &p){
    if(areParallel(l1, l2)) return false;
    p.x = (l1.c*l2.b - l1.b*l2.c) / (l2.a*l1.b - l2.b*l1.a);
    if(fabs(l1.b) > EPS) p.y = -(l1.a*p.x + l1.c);
    else p.y = -(l2.a*p.x + l2.c);
    return true;
}

double dist(point a, point b){
    return sqrt( (a.x-b.x)*(a.x-b.x) + ((a.y-b.y)*(a.y-b.y)));
}

vector<string> split(const string& s, char delimiter)
{
   vector<string> tokens;
   string token;
   istringstream tokenStream(s);
   while (getline(tokenStream, token, delimiter))
   {
      tokens.push_back(token);
   }
   return tokens;
}

struct vec {
    double x, y;
    vec(double _x, double _y) : x(_x), y(_y) {}
};
vec toVec(point a, point b) {
    return vec(b.x - a.x, b.y - a.y);
}
vec scale(vec v, double s) {
    return vec(v.x * s, v.y * s);
}
point translate(point p, vec v) {
    return point(p.x + v.x , p.y + v.y);
}
double dot(vec a, vec b) {
    return (a.x * b.x + a.y * b.y);
}
double cross(vec a, vec b) {
    return a.x * b.y - a.y * b.x;
}
double norm_sq(vec v) {
    return v.x * v.x + v.y * v.y;
}
point rot(point p, double theta) {
    double rad = (theta*M_PI)/180.0; // multiply theta with PI / 180.0
    point p2(p.x * cos(rad) - p.y * sin(rad), p.x * sin(rad) + p.y * cos(rad));
    if(abs(p2.x) < EPS) p2.x = 0.0;
    if(abs(p2.y) < EPS) p2.y = 0.0;
    return p2;
}
double angle(point a, point o, point b) { // returns angle aob in rad
vec oa = toVec(o, a), ob = toVec(o, b);
return acos(dot(oa, ob) / sqrt(norm_sq(oa) * norm_sq(ob))); }

double distToLine(point p, point a, point b, point &c) {
    // formula: c = a + u * ab
    vec ap = toVec(a, p), ab = toVec(a, b);
    double u = dot(ap, ab) / norm_sq(ab);
    c = translate(a, scale(ab, u)); // translate a to c
    return dist(p, c);
}

double distToLineSegment(point p, point a, point b, point &c) {
    vec ap = toVec(a, p), ab = toVec(a, b);
    double u = dot(ap, ab) / norm_sq(ab);
    if (u < 0.0) { c = point(a.x, a.y); // closer to a
    return dist(p, a); } // Euclidean distance between p and a
    if (u > 1.0) { c = point(b.x, b.y); // closer to b
    return dist(p, b); } // Euclidean distance between p and b
    return distToLine(p, a, b, c);
}

int main(){

    line diag;
    cin >> diag.a >> diag.b >> diag.c;
    point A, B;
    cin >> A.x >> A.y;
    cin >> B.x >> B.y;

    double d0 = abs( A.x - B.x ) + abs( A.y - B.y );

    if(abs(diag.a) < EPS or abs(diag.b) < EPS )
        return cout << d0, 0;

    /** from x to x **/
    point newA(A.x, ( - diag.a * A.x - diag.c) / diag.b ),
          newB(B.x, ( - diag.a * B.x - diag.c) / diag.b );
    double d1 = dist(newA, newB) + dist(A, newA) + dist(B, newB);

    /** from y to y **/
    newA = point (( - diag.b * A.y - diag.c) / diag.a, A.y ),
    newB = point (( - diag.b * B.y - diag.c) / diag.a, B.y );
    double d2 = dist(newA, newB) + dist(A, newA) + dist(B, newB);

    /** from x to y **/
    newA = point (A.x, ( - diag.a * A.x - diag.c) / diag.b ),
    newB = point (( - diag.b * B.y - diag.c) / diag.a, B.y );
    double d3 = dist(newA, newB) + dist(A, newA) + dist(B, newB);

    /** from y to x **/
    newA = point (( - diag.b * A.y - diag.c) / diag.a, A.y ),
    newB = point (B.x, ( - diag.a * B.x - diag.c) / diag.b );
    double d4 = dist(newA, newB) + dist(A, newA) + dist(B, newB);

    d0 = min( d0, min( d1, min( d2, min( d3, d4 ) ) ) );

    cout << fixed << setprecision(10) << d0;

}


#include <bits/stdc++.h>

#define fi first
#define se second
#define p_b push_back
#define m_p make_pair
#define pll pair<ll, ll>
#define sqr(x) ((x) * (x))
#define pii pair<int, int>
#define stop system("pause");
#define all(x) x.begin(), x.end()
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0);
#define ms(args...) {args}
#define x1 gdjhdo
#define y1 ghfdjhdo
typedef long long ll;
typedef long double ld;

using namespace std;

template <typename T>
void vout(T x){
    cout << x << endl;
    exit(0);
}

int gcd(int a, int b){
    while(a && b){
        if (a > b) a %= b;
        else b %= a;
    }
    return a + b;
}

const int inf = 1e9;
const ll INF = 1e18;
vector<pair<ld, ld> > v, v1;
ld mn, a, b, c, x1, y1, x2, y2;
ld rast(ld E, ld E1, ld E2, ld E3){
    return sqrt(sqr(E - E2) + sqr(E1 - E3));
}
int main()
{
    fast_io
    cin >> a >> b >> c >> x1 >> y1 >> x2 >> y2;
    mn = abs(x1 - x2) + abs(y1 - y2);
    ld x, y;
    x = x1;
    y = (-c - a*x) / b;
    v.p_b({x, y});

    y = y1;
    x = (-c - b*y) / a;
    v.p_b({x, y});

    x = x2;
    y = (-c - a*x) / b;
    v1.p_b({x, y});

    y = y2;
    x = (-c - b*y) / a;
    v1.p_b({x, y});

    for (int i=0; i<2; ++i){
        for (int j=0; j<2; ++j){
            mn = min(mn, rast(v[i].fi, v[i].se, x1, y1) + rast(v1[j].fi, v1[j].se, x2, y2) + rast(v[i].fi, v[i].se, v1[j].fi, v1[j].se));
        }
    }
    cout << fixed << setprecision(10) << mn << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
double a, b, c, xx1, xx2, xx3, xx4, yy1, yy2, yy3, yy4, a1, a2, a3, a4, a5;
inline double dis(double x, double y, double x1, double y1) {
	return (sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1)));
}
int main() {
	scanf("%lf%lf%lf%lf%lf%lf%lf", &a, &b, &c, &xx1, &yy1, &xx2, &yy2);
	xx3 = ((-1) * (c + b * yy1)) / a, xx4 = ((-1) * (c + b * yy2)) / a;
	yy3 = ((-1) * (c + a * xx1)) / b, yy4 = ((-1) * (c + a * xx2)) / b;
	a1 = (abs(xx1 - xx2) + abs(yy1 - yy2));
	a2 = abs(xx1 - xx3) + dis(xx3, yy1, xx4, yy2) + abs(xx4 - xx2);
	a3 = abs(xx1 - xx3) + dis(xx3, yy1, xx2, yy4) + abs(yy4 - yy2);
	a4 = abs(yy1 - yy3) + dis(xx1, yy3, xx4, yy2) + abs(xx4 - xx2);
	a5 = abs(yy1 - yy3) + dis(xx1, yy3, xx2, yy4) + abs(yy4 - yy2);
	printf("%.10f", min(a1, min(a2, min(a3, min(a4, a5)))));
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define db double
using namespace std;

struct point{
	db x,y;
	void in(){scanf("%lf%lf",&x,&y);}
	point(){}
	point(db a,db b):x(a),y(b){}
}p1,p2,cp1[3],cp2[3];
struct line{
	db ta,tb,tc;
	void in(){scanf("%lf%lf%lf",&ta,&tb,&tc);}
	line(){}
	line(db a,db b,db c):ta(a),tb(b),tc(c){}
	point getx(db y){db x=(-tc-tb*y)/ta;return point(x,y);}
	point gety(db x){db y=(-tc-ta*x)/tb;return point(x,y);}
}l;
db Sqr(db a){return a*a;}
db dist(point a,point b){return sqrt(Sqr(a.x-b.x)+Sqr(a.y-b.y));}
db getalldis(point pp1,point pp2){return dist(p1,pp1)+dist(pp1,pp2)+dist(pp2,p2);}
db ans=1e12;
db ABS(db a){return a<0?-a:a;}
db dir(point a,point b){return ABS(a.x-b.x)+ABS(a.y-b.y);}
int main(){
	l.in();
	p1.in();p2.in();
	cp1[1]=l.getx(p1.y);
	cp1[2]=l.gety(p1.x);
	cp2[1]=l.getx(p2.y);
	cp2[2]=l.gety(p2.x);
	ans=dir(p1,p2);
	for(int i=1;i<=2;i++){
		for(int j=1;j<=2;j++){
			ans=min(ans,getalldis(cp1[i],cp2[j]));
		}
	}
	printf("%.8lf\n",ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=200010;
int a,b,c;
int X1,X2,Y1,Y2;
int X3,X4,Y3,Y4;
double dis(int a,int b,int c,int d){
	return sqrt(1.0*(a-c)*(a-c)+1.0*(d-b)*(d-b));
}
int exgcd(int a,int b,int &x,int &y)
{
     if(b==0)
    {
        x=1;
        y=0;
        return a;
    }
    int gcd=exgcd(b,a%b,x,y);
    int x2=x,y2=y;
    x=y2;
    y=x2-(a/b)*y2;
    return gcd;
}

int _abs(int x){
	return x>0?x:-x;
}

int dis2(int a,int b,int c,int d){
	return _abs(a-c)+_abs(b-d);
}

int main(){
#ifdef WK
	freopen("in.txt","r",stdin);
#endif
	cin>>a>>b>>c>>X1>>Y1>>X2>>Y2;
	if(a==0||b==0||(X1==X2)||(Y1==Y2)){
		printf("%.9lf\n",_abs(X1-X2)+_abs(Y1-Y2));
		return 0;
	}
	double k1=-1.0*b/a;
	double k2=1.0*(X2-X1)/(Y2-Y1);
	if(k1*k2<0){
		printf("%.9lf\n",_abs(X1-X2)+_abs(Y1-Y2));
		return 0;
	}
	int X,Y;
	exgcd(a,b,X,Y);
	c=-c;
	X=(X*c)%b;
	Y=(c-a*X)/b;
	int XX1=X1,XX2=X2;
	int YY1=Y1,YY2=Y2;
	if(X1>X2)swap(X1,X2);
	if(Y1>Y2)swap(Y1,Y2);
	int gcd=__gcd(a,b);
	a/=gcd;b/=gcd;
	a=-a;
	double L,R;
	if(b<0){
		L=(double)(X2-X)/b;
		R=(double)(X1-X)/b;
	}
	else{
		L=(double)(X1-X)/b;
		R=(double)(X2-X)/b;
	}
	if(a<0){
		L=max(L,(double)(Y2-Y)/a);
		R=min(R,(double)(Y1-Y)/a);
	}else{
		L=max(L,(double)(Y1-Y)/a);
		R=min(R,(double)(Y2-Y)/a);
	}
	int LL=ceil(L),RR=floor(R);
	X1=XX1;X2=XX2;Y1=YY1;Y2=YY2;
	if(X1>X2)swap(X1,X2),swap(Y1,Y2);

	if(Y1<Y2){
		X3=X+LL*b;Y3=Y+RR*a;
		X4=X+RR*b;Y4=Y+LL*a;
	}else{
		X3=X+LL*b;Y4=Y+RR*a;
		X4=X+RR*b;Y3=Y+LL*a;
	}
	double ans=min(1.0*dis2(X1,Y1,X2,Y2),dis2(X1,Y1,X3,Y3)+dis2(X2,Y2,X4,Y4)+dis(X3,Y3,X4,Y4));
	printf("%.9lf\n",ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=200010;
LL a,b,c;
LL X1,X2,Y1,Y2;
LL X3,X4,Y3,Y4;
double dis(int a,int b,int c,int d){
	return sqrt(1.0*(a-c)*(a-c)+1.0*(d-b)*(d-b));
}
LL exgcd(LL a,LL b,LL &x,LL &y)
{
     if(b==0)
    {
        x=1;
        y=0;
        return a;
    }
    LL gcd=exgcd(b,a%b,x,y);
    LL x2=x,y2=y;
    x=y2;
    y=x2-(a/b)*y2;
    return gcd;
}

LL _abs(int x){
	return x>0?x:-x;
}

LL dis2(int a,int b,int c,int d){
	return _abs(a-c)+_abs(b-d);
}

int main(){
#ifdef WK
	freopen("in.txt","r",stdin);
#endif
	cin>>a>>b>>c>>X1>>Y1>>X2>>Y2;
	if(a==0||b==0||(X1==X2)||(Y1==Y2)){
		printf("%.9lf\n",1.0*_abs(X1-X2)+1.0*_abs(Y1-Y2));
		return 0;
	}
	double k1=-1.0*b/a;
	double k2=1.0*(X2-X1)/(Y2-Y1);
	if(k1*k2<0){
		printf("%.9lf\n",1.0*_abs(X1-X2)+1.0*_abs(Y1-Y2));
		return 0;
	}
	LL X,Y;
	exgcd(a,b,X,Y);
	c=-c;
	X=(X*c)%b;
	Y=(c-a*X)/b;
	int XX1=X1,XX2=X2;
	int YY1=Y1,YY2=Y2;
	if(X1>X2)swap(X1,X2);
	if(Y1>Y2)swap(Y1,Y2);
	int gcd=__gcd(a,b);
	a/=gcd;b/=gcd;
	a=-a;
	double L,R;
	if(b<0){
		L=(double)(X2-X)/b;
		R=(double)(X1-X)/b;
	}
	else{
		L=(double)(X1-X)/b;
		R=(double)(X2-X)/b;
	}
	if(a<0){
		L=max(L,(double)(Y2-Y)/a);
		R=min(R,(double)(Y1-Y)/a);
	}else{
		L=max(L,(double)(Y1-Y)/a);
		R=min(R,(double)(Y2-Y)/a);
	}
	LL LL=ceil(L),RR=floor(R);
	X1=XX1;X2=XX2;Y1=YY1;Y2=YY2;
	if(X1>X2)swap(X1,X2),swap(Y1,Y2);

	if(Y1<Y2){
		X3=X+LL*b;Y3=Y+RR*a;
		X4=X+RR*b;Y4=Y+LL*a;
	}else{
		X3=X+LL*b;Y4=Y+RR*a;
		X4=X+RR*b;Y3=Y+LL*a;
	}
	double ans=min(1.0*dis2(X1,Y1,X2,Y2),dis2(X1,Y1,X3,Y3)+dis2(X2,Y2,X4,Y4)+dis(X3,Y3,X4,Y4));
	printf("%.9lf\n",ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=200010;
LL a,b,c;
LL X1,X2,Y1,Y2;
double dis(double a,double b,double c,double d){
	return sqrt(1.0*(a-c)*(a-c)+1.0*(d-b)*(d-b));
}
LL exgcd(LL a,LL b,LL &x,LL &y)
{
     if(b==0)
    {
        x=1;
        y=0;
        return a;
    }
    LL gcd=exgcd(b,a%b,x,y);
    LL x2=x,y2=y;
    x=y2;
    y=x2-(a/b)*y2;
    return gcd;
}

double _abs(double x){
	return x>0?x:-x;
}

double dis2(double a,double b,double c,double d){
	return _abs(a-c)+_abs(b-d);
}

int main(){
#ifdef WK
	freopen("in.txt","r",stdin);
//	freopen("out.txt","w",stdout);
#endif
	cin>>a>>b>>c>>X1>>Y1>>X2>>Y2;
	if(a==0||b==0||(X1==X2)||(Y1==Y2)){
		printf("%.9lf\n",1.0*_abs(X1-X2)+1.0*_abs(Y1-Y2));
		return 0;
	}
	double k1=-1.0*b/a;
	double k2=1.0*(X2-X1)/(Y2-Y1);
	if(k1*k2<0){
		printf("%.9lf\n",1.0*_abs(X1-X2)+1.0*_abs(Y1-Y2));
		return 0;
	}
	double X3,X4,Y3,Y4;
	double ans=dis2(X1,Y1,X2,Y2);
	double LX=min(X1,X2),RX=max(X1,X2);
	double LY=min(Y1,Y2),RY=max(Y1,Y2);
	X3=LX,Y3=-(c+a*X3)/b;
	if(Y3>RY||Y3<LY){
		if(k1>0){
			Y3=LY;
		}else{
			Y3=RY;
		}X3=-(c+b*Y3)/a;
	}
	X4=RX,Y4=-(c+a*X4)/b;
	if(Y4>RY||Y4<LY){
		if(k1>0){
			Y4=RY;
		}else Y4=LY;
		X4=-(c+b*Y4)/a;
	}
	if(X3>X4){
		swap(X3,X4);
		swap(Y3,Y4);
	}
	if(X1>X2){
		swap(X1,X2);
		swap(Y1,Y2);
	}
	ans=min(ans,dis2(X1,Y1,X3,Y3)+dis2(X2,Y2,X4,Y4)+dis(X3,Y3,X4,Y4));
	printf("%.9lf\n",ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=200010;
LL a,b,c;
LL X1,X2,Y1,Y2;
double dis(LL a,LL b,LL c,LL d){
	return sqrt(1.0*(a-c)*(a-c)+1.0*(d-b)*(d-b));
}
LL exgcd(LL a,LL b,LL &x,LL &y)
{
     if(b==0)
    {
        x=1;
        y=0;
        return a;
    }
    LL gcd=exgcd(b,a%b,x,y);
    LL x2=x,y2=y;
    x=y2;
    y=x2-(a/b)*y2;
    return gcd;
}

double _abs(double x){
	return x>0?x:-x;
}

double dis2(double a,double b,double c,double d){
	return _abs(a-c)+_abs(b-d);
}

int main(){
#ifdef WK
	freopen("in.txt","r",stdin);
//	freopen("out.txt","w",stdout);
#endif
	cin>>a>>b>>c>>X1>>Y1>>X2>>Y2;
	if(a==0||b==0||(X1==X2)||(Y1==Y2)){
		printf("%.9lf\n",1.0*_abs(X1-X2)+1.0*_abs(Y1-Y2));
		return 0;
	}
	double k1=-1.0*b/a;
	double k2=1.0*(X2-X1)/(Y2-Y1);
	if(k1*k2<0){
		printf("%.9lf\n",1.0*_abs(X1-X2)+1.0*_abs(Y1-Y2));
		return 0;
	}
	double X3,X4,Y3,Y4;
	double ans=dis2(X1,Y1,X2,Y2);
	double LX=min(X1,X2),RX=max(X1,X2);
	double LY=min(Y1,Y2),RY=max(Y1,Y2);
	X3=LX,Y3=-(c+a*X3)/b;
	if(Y3>RY||Y3<LY){
		if(k1>0){
			Y3=LY;
		}else{
			Y3=RY;
		}X3=-(c+b*Y3)/a;
	}
	X4=RX,Y4=-(c+a*X4)/b;
	if(Y4>RY||Y4<LY){
		if(k1>0){
			Y4=RY;
		}else Y4=LY;
		X4=-(c+b*Y4)/a;
	}
	if(X3>X4){
		swap(X3,X4);
		swap(Y3,Y4);
	}
	if(X1>X2){
		swap(X1,X2);
		swap(Y1,Y2);
	}
	ans=min(ans,dis2(X1,Y1,X3,Y3)+dis2(X2,Y2,X4,Y4)+dis(X3,Y3,X4,Y4));
	printf("%.9lf\n",ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=200010;
int a,b,c;
int X1,X2,Y1,Y2;
int X3,X4,Y3,Y4;
double dis(int a,int b,int c,int d){
	return sqrt(1.0*(a-c)*(a-c)+1.0*(d-b)*(d-b));
}
int exgcd(int a,int b,int &x,int &y)
{
     if(b==0)
    {
        x=1;
        y=0;
        return a;
    }
    int gcd=exgcd(b,a%b,x,y);
    int x2=x,y2=y;
    x=y2;
    y=x2-(a/b)*y2;
    return gcd;
}

int _abs(int x){
	return x>0?x:-x;
}

int dis2(int a,int b,int c,int d){
	return _abs(a-c)+_abs(b-d);
}

int main(){
#ifdef WK
	freopen("in.txt","r",stdin);
#endif
	cin>>a>>b>>c>>X1>>Y1>>X2>>Y2;
	if(a==0||b==0||(X1==X2)||(Y1==Y2)){
		printf("%.9lf\n",_abs(X1-X2)+_abs(Y1-Y2));
		return 0;
	}
	double k1=-1.0*b/a;
	double k2=1.0*(X2-X1)/(Y2-Y1);
	if(k1*k2<0){
		printf("%.9lf\n",_abs(X1-X2)+_abs(Y1-Y2));
		return 0;
	}
	int X,Y;
	exgcd(a,b,X,Y);
	c=-c;
	X=(X*c)%b;
	Y=(c-a*X)/b;
	int XX1=X1,XX2=X2;
	int YY1=Y1,YY2=Y2;
	if(X1>X2)swap(X1,X2);
	if(Y1>Y2)swap(Y1,Y2);
	int gcd=__gcd(a,b);
	a/=gcd;b/=gcd;
	a=-a;
	double L,R;
	if(b<0){
		L=(double)(X2-X)/b;
		R=(double)(X1-X)/b;
	}
	else{
		L=(double)(X1-X)/b;
		R=(double)(X2-X)/b;
	}
	if(a<0){
		L=max(L,(double)(Y2-Y)/a);
		R=min(R,(double)(Y1-Y)/a);
	}else{
		L=max(L,(double)(Y1-Y)/a);
		R=min(R,(double)(Y2-Y)/a);
	}
	int LL=ceil(L),RR=floor(R);
	X1=XX1;X2=XX2;Y1=YY1;Y2=YY2;
	if(X1>X2)swap(X1,X2),swap(Y1,Y2);

	if(Y1<Y2){
		X3=X+LL*b;Y3=Y+RR*a;
		X4=X+RR*b;Y4=Y+LL*a;
	}else{
		X3=X+LL*b;Y4=Y+RR*a;
		X4=X+RR*b;Y3=Y+LL*a;
	}
	printf("%.9lf\n",dis2(X1,Y1,X3,Y3)+dis2(X2,Y2,X4,Y4)+dis(X3,Y3,X4,Y4));
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=200010;
LL a,b,c;
LL X1,X2,Y1,Y2;
double dis(LL a,LL b,LL c,LL d){
	return sqrt(1.0*(a-c)*(a-c)+1.0*(d-b)*(d-b));
}
LL exgcd(LL a,LL b,LL &x,LL &y)
{
     if(b==0)
    {
        x=1;
        y=0;
        return a;
    }
    LL gcd=exgcd(b,a%b,x,y);
    LL x2=x,y2=y;
    x=y2;
    y=x2-(a/b)*y2;
    return gcd;
}

double _abs(double x){
	return x>0?x:-x;
}

double dis2(double a,double b,double c,double d){
	return _abs(a-c)+_abs(b-d);
}

int main(){
#ifdef WK
	freopen("in.txt","r",stdin);
//	freopen("out.txt","w",stdout);
#endif
	cin>>a>>b>>c>>X1>>Y1>>X2>>Y2;
	if(a==0||b==0||(X1==X2)||(Y1==Y2)){
		printf("%.9lf\n",1.0*_abs(X1-X2)+1.0*_abs(Y1-Y2));
		return 0;
	}
	double k1=-1.0*b/a;
	double k2=1.0*(X2-X1)/(Y2-Y1);
	if(k1*k2<0){
		printf("%.9lf\n",1.0*_abs(X1-X2)+1.0*_abs(Y1-Y2));
		return 0;
	}
	double X3,X4,Y3,Y4;
	double ans=dis2(X1,Y1,X2,Y2);
	double LX=min(X1,X2),RX=max(X1,X2);
	double LY=min(Y1,Y2),RY=max(Y1,Y2);
	X3=LX,Y3=-(c+a*X3)/b;
	if(Y3>RY||Y3<LY){
		Y3=LY;X3=-(c+b*Y3)/a;
	}
	X4=RX,Y4=-(c+a*X4)/b;
	if(Y4>RY||Y4<LY){
		Y4=LY;X4=-(c+b*Y4)/a;
	}
	if(X3>X4){
		swap(X3,X4);
		swap(Y3,Y4);
	}
	if(X1>X2){
		swap(X1,X2);
		swap(Y1,Y2);
	}
	ans=min(ans,dis2(X1,Y1,X3,Y3)+dis2(X2,Y2,X4,Y4)+dis(X3,Y3,X4,Y4));
	printf("%.9lf\n",ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=200010;
int a,b,c;
int X1,X2,Y1,Y2;
int X3,X4,Y3,Y4;
double dis(int a,int b,int c,int d){
	return sqrt(1.0*(a-c)*(a-c)+1.0*(d-b)*(d-b));
}
int exgcd(int a,int b,int &x,int &y)
{
     if(b==0)
    {
        x=1;
        y=0;
        return a;
    }
    int gcd=exgcd(b,a%b,x,y);
    int x2=x,y2=y;
    x=y2;
    y=x2-(a/b)*y2;
    return gcd;
}

int _abs(int x){
	return x>0?x:-x;
}

int dis2(int a,int b,int c,int d){
	return _abs(a-c)+_abs(b-d);
}

int main(){
#ifdef WK
	freopen("in.txt","r",stdin);
#endif
	cin>>a>>b>>c>>X1>>Y1>>X2>>Y2;
	if(a==0||b==0||(X1==X2)||(Y1==Y2)){
		printf("%.9lf\n",1.0*_abs(X1-X2)+1.0*_abs(Y1-Y2));
		return 0;
	}
	double k1=-1.0*b/a;
	double k2=1.0*(X2-X1)/(Y2-Y1);
	if(k1*k2<0){
		printf("%.9lf\n",1.0*_abs(X1-X2)+1.0*_abs(Y1-Y2));
		return 0;
	}
	int X,Y;
	exgcd(a,b,X,Y);
	c=-c;
	X=(X*c)%b;
	Y=(c-a*X)/b;
	int XX1=X1,XX2=X2;
	int YY1=Y1,YY2=Y2;
	if(X1>X2)swap(X1,X2);
	if(Y1>Y2)swap(Y1,Y2);
	int gcd=__gcd(a,b);
	a/=gcd;b/=gcd;
	a=-a;
	double L,R;
	if(b<0){
		L=(double)(X2-X)/b;
		R=(double)(X1-X)/b;
	}
	else{
		L=(double)(X1-X)/b;
		R=(double)(X2-X)/b;
	}
	if(a<0){
		L=max(L,(double)(Y2-Y)/a);
		R=min(R,(double)(Y1-Y)/a);
	}else{
		L=max(L,(double)(Y1-Y)/a);
		R=min(R,(double)(Y2-Y)/a);
	}
	int LL=ceil(L),RR=floor(R);
	X1=XX1;X2=XX2;Y1=YY1;Y2=YY2;
	if(X1>X2)swap(X1,X2),swap(Y1,Y2);

	if(Y1<Y2){
		X3=X+LL*b;Y3=Y+RR*a;
		X4=X+RR*b;Y4=Y+LL*a;
	}else{
		X3=X+LL*b;Y4=Y+RR*a;
		X4=X+RR*b;Y3=Y+LL*a;
	}
	double ans=min(1.0*dis2(X1,Y1,X2,Y2),dis2(X1,Y1,X3,Y3)+dis2(X2,Y2,X4,Y4)+dis(X3,Y3,X4,Y4));
	printf("%.9lf\n",ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int oo=1e9;
const int N=1e5+1;
long double dis(long double a, long double b, long double c, long double d)
{
	return sqrt((a-c)*(a-c)+(b-d)*(b-d));
}
int main()
{
//	freopen("input.txt","r",stdin);
	long double a,b,c,x1,y1,x2,y2,res1,res2,d1,d2,xd,yd,xc,yc,xa1,xa2,ya1,ya2,xb1,xb2,yb1,yb2;
	cin>>a>>b>>c>>x1>>y1>>x2>>y2;
	res1=abs(x1-x2)+abs(y1-y2);
	xd=x1;
	if(b==0)yd=1e18;else yd=(-c-a*x1)/b;
	yc=y1;
	if(a==0)xc=1e18;else xc=(-c-b*y1)/a;
	xa1=xd;ya1=yd;
	xa2=xc;ya2=yc;

	xd=x2;
	if(b==0)yd=-1e18;else yd=(-c-a*x2)/b;
	yc=y2;
	if(a==0)xc=-1e18;else xc=(-c-b*y2)/a;
	xb1=xd;yb1=yd;
	xb2=xc;yb2=yc;

	res1=min(res1,dis(x1,y1,xa1,ya1)+dis(x2,y2,xb1,yb1)+dis(xa1,ya1,xb1,yb1));
	res1=min(res1,dis(x1,y1,xa2,ya2)+dis(x2,y2,xb1,yb1)+dis(xa2,ya2,xb1,yb1));
	res1=min(res1,dis(x1,y1,xa1,ya1)+dis(x2,y2,xb2,yb2)+dis(xa1,ya1,xb2,yb2));
	res1=min(res1,dis(x1,y1,xa2,ya2)+dis(x2,y2,xb2,yb2)+dis(xa2,ya2,xb2,yb2));
	cout<<fixed<<setprecision(15)<<res1;
}


#include <iostream>
#include <complex>
#include <cstdlib>
#include <cmath>

using namespace std;

void minimize(double &a,double b)
{
  a=min(a,b);
}

typedef long long int ll;

ll absolut(ll x)
{
  if (x<0) return -x;
  return x;
}

typedef complex<double> point;

int a,b,c;

point getfromx(double x)
{
  double y=(-c-a*x)/b;
  return point(x,y);
}

point getfromy(double y)
{
  double x=(-c-b*y)/a;
  return point(x,y);
}

point p1,p2;
double sol;

double getdist(point P1,point P2)
{
  return abs(p1-P1)+abs(P1-P2)+abs(P2-p2);
}

int main()
{
  cout.setf(ios::fixed);
  cout.precision(10);
  cin>>a>>b>>c;
  int x1,y1,x2,y2;
  cin>>x1>>y1>>x2>>y2;
  sol=absolut(x1-x2)+absolut(y1-y2);
  if (a==0 or b==0) {
    cout<<sol<<endl;
    exit(0);
  }
  p1=point(x1,y1);
  p2=point(x2,y2);
  minimize(sol,getdist(getfromx(x1),getfromx(x2)));
  minimize(sol,getdist(getfromx(x1),getfromy(y2)));
  minimize(sol,getdist(getfromy(y1),getfromx(x2)));
  minimize(sol,getdist(getfromy(y1),getfromy(y2)));
  cout<<sol<<endl;
}


#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <cstring>

#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>

#define rep(_var,_begin,_end) for (int _var = (_begin); _var <= (_end); _var++)
#define rep_(_var,_end,_begin) for (int _var = (_end); _var >= (_begin); _var--)
#define range(_begin,_end) rep(_,_begin,_end)
#define range_(_end,_begin) rep_(_,_begin,_end)
#define minimize(_var,_targ) _var = min(_var, _targ)
#define maximize(_var,_targ) _var = max(_var, _targ)
#define memclr(_arr) memset(_arr, 0, sizeof(_arr))

#define sqr(__x) ((__x)*(__x))

using namespace std;
typedef unsigned long long ull;
typedef long long lli;
typedef double llf;

const llf infinit = 1e16f;
const int maxn = 10;

lli a_, b_, c_, x1, y1, x2, y2;
llf a, b, c;

int n;
llf len[maxn][maxn], dis[maxn];
bool inque[maxn];

llf dist(llf xa, llf ya, llf xb, llf yb)
{
    return sqrt(sqr(xa - xb) + sqr(ya - yb));
}

int main(int argc, char** argv)
{
    scanf("%lld%lld%lld", &a_, &b_, &c_);
    scanf("%lld%lld%lld%lld", &x1, &y1, &x2, &y2);
    int start_node = 1, end_node = 4;
    // Determine where to start
    if (x1 <= x2 && y1 <= y2)
        start_node = 1, end_node = 4;
    else if (x1 > x2 && y1 <= y2)
        start_node = 2, end_node = 3;
    else if (x1 <= x2 && y1 > y2)
        start_node = 3, end_node = 2;
    else if (x1 > x2 && y1 > y2)
        start_node = 4, end_node = 1;
    // Choose smallest edges
    if (x1 > x2)
        swap(x1, x2);
    if (y1 > y2)
        swap(y1, y2);
    llf res = 0;
    if (a_ == 0 || b_ == 0) {
        // Avenue parallel to streets
        res = (y2 - y1) + (x2 - x1);
    } else {
        a = a_, b = b_, c = c_;
        // Diagonal avenue
        llf x5 = x1, y5 = - a / b * x5 - c / b,
            x6 = x2, y6 = - a / b * x6 - c / b,
            y7 = y1, x7 = - b / a * y7 - c / a,
            y8 = y2, x8 = - b / a * y8 - c / a;
        // Build Dijkstra graph
        n = 8;
        rep(i, 1, n)
            rep(j, 1, n)
                len[i][j] = infinit;
        len[1][2] = dist(x1, y1, x2, y1);
        len[1][3] = dist(x1, y1, x1, y2);
        len[2][4] = dist(x2, y1, x2, y2);
        len[3][4] = dist(x1, y2, x2, y2);
        len[1][5] = dist(x1, y1, x5, y5);
        len[3][5] = dist(x1, y2, x5, y5);
        len[2][6] = dist(x2, y1, x6, y6);
        len[4][6] = dist(x2, y2, x6, y6);
        len[1][7] = dist(x1, y1, x7, y7);
        len[2][7] = dist(x2, y1, x7, y7);
        len[3][8] = dist(x1, y2, x8, y8);
        len[4][8] = dist(x2, y2, x8, y8);
        len[5][6] = dist(x5, y5, x6, y6);
        len[5][7] = dist(x5, y5, x7, y7);
        len[5][8] = dist(x5, y5, x8, y8);
        len[6][7] = dist(x6, y6, x7, y7);
        len[6][8] = dist(x6, y6, x8, y8);
        len[7][8] = dist(x7, y7, x8, y8);
        rep(i, 1, n)
            rep(j, i, n)
                len[j][i] = len[i][j];
        // Run Dijkstra
        rep(i, 1, n)
            dis[i] = infinit;
        queue<int> que;
        dis[start_node] = 0;
        inque[start_node] = true;
        que.push(start_node);
        while (!que.empty()) {
            int p = que.front();
            que.pop();
            inque[p] = false;
            rep(q, 1, n)
                if (dis[p] + len[p][q] < dis[q]) {
                    dis[q] = dis[p] + len[p][q];
                    if (!inque[q]) {
                        inque[q] = true;
                        que.push(q);
                    }
                }
        }
        res = dis[end_node];
    }
    printf("%.10f\n", res);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<double, double> pll;
double a, b, c;
pll x1, x2;
double o2(double x) { return x * x; }
double Dist(pll x1, pll x2){
    return sqrt(o2(x1.first - x2.first) + o2(x1.second - x2.second));
}
double dist(pll x1, pll x2){
    return fabs(x1.first - x2.first) + fabs(x1.second - x2.second);
}
int main()
{
    cin >> a >> b >> c;
    cin >> x1.first >> x1.second >> x2.first >> x2.second;
    pll A[] = {{x1.first, -(a * x1.first + c) / b}, {-(b * x1.second + c) / a, x1.second}};
    pll B[] = {{x2.first, -(a * x2.first + c) / b}, {-(b * x2.second + c) / a, x2.second}};
    double ans = dist(x1, x2);
    for (int i = 0; i < 2; i++)
        for (int j = 0; j < 2; j++)
            ans = min(ans, dist(x1, A[i]) + Dist(A[i], B[j]) + dist(x2, B[j])); ///x1->A->B->x2
    printf("%.10f\n", ans);
    return 0;
}


import java.util.*;

public class Perso_cup {

	static Scanner in = new Scanner(System.in);

	public static void main(String[] args) {

		String s = in.next();
		int n = s.length();
		int k = 1;

		while(Math.ceil(n/k) > 20) {
			k++;
		}

		int t = (int) Math.ceil((double)n/(double)k);

		System.out.println(k + " " + t);
		int ind = 0;

		for(int i = 0; i < k; i++) {
			for(int j = 0; j < t; j++) {
				if(ind < s.length()) {
					System.out.print(s.charAt(ind));
					ind++;
				}
				else {
					System.out.print("*");
				}
			}
			System.out.println();
		}
	}
}


import java.util.Scanner;

public class Personalized_Cup {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s =in.next();
		int n = s.length();
		int rows = (int)(Math.ceil(1.0*n/20));
		int cols = (int)(Math.ceil(1.0*n/rows));

		System.out.println(rows +" "+ cols);

		int diff = rows*cols - n;
		int q = diff/rows;
		int r = diff%rows;

		int c = 0;
		for(int i = 0; i<rows; i++) {
			int j;
			for(j = 0; j<q+(i<r?1:0); j++) {
				System.out.print("*");
			}
			for(; j<cols; j++) {
				System.out.print(s.charAt(c)+"");
				c++;
			}
			System.out.println();
		}
	}

}


import java.util.Scanner;

public class C1032BPersonalizedCupProblem {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        int nums = (int) Math.ceil(s.length / 20.0);
        int lih = nums * 20 - s.length;
        int stolb = 20 - lih / nums;
        int li = nums * stolb - s.length;
        System.out.println(nums + " " + stolb);
        int pos = 0;
        for (int i = 0; i < nums; i++) {
            for (int j = 0; j < stolb; j++) {
                if (j == stolb - 1 && (nums - i) <= li) {
                    System.out.print("*");
                } else
                    System.out.print(s[pos++]);
            }
            System.out.println();
        }
    }
}


import java.io.*;
import java.util.*;
import java.lang.String;

import static java.lang.Math.*;

public class Main {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    PrintWriter pw = new PrintWriter(System.out);

    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    String next() throws IOException {
        if (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    public Main() throws FileNotFoundException {
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    long mod = (long) 1e9 + 7;

    void run() throws IOException {
        String s = next();
        char[] a = s.toCharArray();
        int n = s.length();
        if (n <= 20) {
            pw.println(1 + " " + n);
            pw.print(s);
            pw.close();
            return;
        }
        for (int i = 2; i <= 5; i++) {
            if (i * 20 >= n) {
                int e = ((n + (i - n % i) % i) / i);
                pw.println(i + " " + e);
                int x = (i - n % i) % i;
                int count = 0;
                for (int j = 0; j < i; j++) {
                    if (x != 0) {
                        pw.print("*");
                        for (int k = 0; k < e - 1; k++, count++) {
                            pw.print(a[count]);
                        }
                        x--;
                    } else {
                        for (int k = 0; k < e; k++, count++) {
                            pw.print(a[count]);
                        }
                    }
                    pw.println();
                }
                pw.close();
                return;
            }
        }
        pw.close();
    }

    class Pair {
        int x, y;

        public Pair(int a, int b) {
            x = a;
            y = b;
        }
    }

    class PairComp implements Comparator<Pair> {

        @Override
        public int compare(Pair o1, Pair o2) {
            if (o1.x == o2.x) return Integer.compare(o1.y, o2.y);
            return Integer.compare(o1.x, o2.x);
        }
    }
}


import java.io.*;
import java.util.*;
import java.lang.String;

import static java.lang.Math.*;

public class Main {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    PrintWriter pw = new PrintWriter(System.out);

    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    String next() throws IOException {
        if (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    public Main() throws FileNotFoundException {
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    long mod = (long) 1e9 + 7;

    void run() throws IOException {
        String s = next();
        char[] a = s.toCharArray();
        int n = s.length();
        if (n <= 20) {
            pw.println(1 + " " + n);
            pw.print(s);
            pw.close();
            return;
        }
        for (int i = 2; i <= 5; i++) {
            if (i * 20 >= n) {
                int e = ((n + (i - n % i) % i) / i);
                pw.println(i + " " + e);
                int x = i - n % i;
                int count = 0;
                for (int j = 0; j < i; j++) {
                    if (x != 0) {
                        pw.print("*");
                        for (int k = 0; k < e - 1; k++, count++) {
                            pw.print(a[count]);
                        }
                        x--;
                    } else {
                        for (int k = 0; k < e; k++, count++) {
                            pw.print(a[count]);
                        }
                    }
                    pw.println();
                }
                pw.close();
                return;
            }
        }
        pw.close();
    }

    class Pair {
        int x, y;

        public Pair(int a, int b) {
            x = a;
            y = b;
        }
    }

    class PairComp implements Comparator<Pair> {

        @Override
        public int compare(Pair o1, Pair o2) {
            if (o1.x == o2.x) return Integer.compare(o1.y, o2.y);
            return Integer.compare(o1.x, o2.x);
        }
    }
}


import java.io.*;
import java.util.*;
import java.lang.String;

import static java.lang.Math.*;

public class Main {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    PrintWriter pw = new PrintWriter(System.out);

    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    String next() throws IOException {
        if (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    public Main() throws FileNotFoundException {
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    long mod = (long) 1e9 + 7;

    void run() throws IOException {
        String s = next();
        char[] a = s.toCharArray();
        int n = s.length();
        if (n <= 20) {
            pw.println(1 + " " + n);
            pw.print(s);
            pw.close();
            return;
        }
        for (int i = 2; i <= 5; i++) {
            if (i * 20 >= n) {
                pw.println(i + " " + ((n + i - n % i) / i));
                int x = n % i;
                int count = 0;
                for (int j = 0; j < i; j++) {
                    if (x != 0) {
                        pw.print("*");
                        for (int k = 0; k < 14; k++, count++) {
                            pw.print(a[count]);
                        }
                        x--;
                    } else {
                        for (int k = 0; k < 15; k++, count++) {
                            pw.print(a[count]);
                        }
                    }
                    pw.println();
                }
                pw.close();
                return;
            }
        }
        pw.close();
    }

    class Pair {
        int x, y;

        public Pair(int a, int b) {
            x = a;
            y = b;
        }
    }

    class PairComp implements Comparator<Pair> {

        @Override
        public int compare(Pair o1, Pair o2) {
            if (o1.x == o2.x) return Integer.compare(o1.y, o2.y);
            return Integer.compare(o1.x, o2.x);
        }
    }
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    string s;
    cin >> s;
    int ansa = 999999, ansb = 999999;
    bool flag = false;
    for (int i = 1; i <= 5; ++i)
    {
        for (int j = 1; j <= 20; ++j)
        {
            if (i * j >= s.size())
            {
                ansa = i;
                ansb = j;
                flag = true;
                break;
            }
        }
        if (flag)
        {
            break;
        }
    }
    cout << ansa << " " << ansb << endl;
    int cnt = ansa * ansb - s.size();
    int ot = 0;
    for (int i = 0; i < ansa; ++i)
    {
        if (cnt)
        {
            cout << "*";
            cnt--;
            ot = 1;
        }
        else
        {
            ot = 0;
        }
        for (int j = 0; j < ansb - ot; ++j)
        {
            if (s.size() <= ansb * i + j)
            {
                break;
            }
            cout << s[ansb * i + j];
        }
        cout << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    string s;
    cin >> s;
    int ansa = 999999, ansb = 999999;
    bool flag = false;
    for (int i = 1; i < 5; ++i)
    {
        for (int j = 1; j < 20; ++j)
        {
            if (i * j >= s.size())
            {
                ansa = i;
                ansb = j;
                flag = true;
                break;
            }
        }
        if (flag)
        {
            break;
        }
    }
    cout << ansa << " " << ansb;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    string s;
    cin >> s;
    int ansa = 999999, ansb = 999999;
    bool flag = false;
    for (int i = 1; i <= 5; ++i)
    {
        for (int j = 1; j <= 20; ++j)
        {
            if (i * j >= s.size())
            {
                ansa = i;
                ansb = j;
                flag = true;
                break;
            }
        }
        if (flag)
        {
            break;
        }
    }
    cout << ansa << " " << ansb << endl;
    int cnt = ansa * ansb - s.size();
    int cnta = 0, cntb = 0;
    flag = true;
    for (auto el : s)
    {
        if (cnta >= ansa - cnt && flag)
        {
            cout << "*";
            cntb++;
            flag = false;
        }
        cout << el;
        cntb++;
        if (cntb == ansb)
        {
            cntb = 0;
            cnta++;
            cout << endl;
            flag = true;
        }
    }
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    string s;
    cin >> s;
    int ansa = 999999, ansb = 999999;
    bool flag = false;
    for (int i = 1; i < 5; ++i)
    {
        for (int j = 1; j < 20; ++j)
        {
            if (i * j >= s.size())
            {
                ansa = i;
                ansb = j;
                flag = true;
                break;
            }
        }
        if (flag)
        {
            break;
        }
    }
    cout << ansa << " " << ansb << endl;
    for (int i = 0; i < ansa; ++i)
    {
        int cnt = ansb;
        for (int j = 0; j < ansb; ++j)
        {
            if (s.size() <= ansb * i + j)
            {
                break;
            }
            cout << s[ansb * i + j];
            cnt--;
        }
        for (int j = 0; j < cnt; ++j)
        {
            cout << "*";
        }
        cout << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    string s;
    cin >> s;
    int ansa = 999999, ansb = 999999;
    bool flag = false;
    for (int i = 1; i <= 5; ++i)
    {
        for (int j = 1; j <= 20; ++j)
        {
            if (i * j >= s.size())
            {
                ansa = i;
                ansb = j;
                flag = true;
                break;
            }
        }
        if (flag)
        {
            break;
        }
    }
    cout << ansa << " " << ansb << endl;
    for (int i = 0; i < ansa; ++i)
    {
        int cnt = ansb;
        for (int j = 0; j < ansb; ++j)
        {
            if (s.size() <= ansb * i + j)
            {
                break;
            }
            cout << s[ansb * i + j];
            cnt--;
        }
        for (int j = 0; j < cnt; ++j)
        {
            cout << "*";
        }
        cout << endl;
    }
}


#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    string s = "";
    cin >> s;
    long len = s.size();
    for (int i = 1; i <= 5; i++) {
        if (len % i == 0 && len / i <= 20) {
            cout << i << " " << len / i << endl;
            for (int j = 0; j < i; j++) {
                cout << s.substr(0, len / i);
                s.erase(0, len / i);
                cout << endl;
            }
            return 0;
        }
        if ((len + len % i) / i <= 20 && (len + len % i) / i * i >= len) {
            cout << i << " " << (len + len % i) / i << endl;
            long x = (len + len % i) / i * i - len;
            for (int j = 0; j < i; j++) {
                if (x > 0) {
                    cout << s.substr(0, (len + len % i) / i - 1) << "*";
                    s.erase(0, (len + len % i) / i - 1);
                    cout << endl;
                    x--;
                }
                else {
                    cout << s.substr(0, (len + len % i) / i);
                    s.erase(0, (len + len % i) / i);
                    cout << endl;
                }
            }
            return 0;
        }
    }
}


#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    string s = "";
    cin >> s;
    long len = s.size();
    for (int i = 1; i <= 5; i++) {
        if (len % i == 0 && len / i <= 20) {
            cout << i << " " << len / i << endl;
            for (int j = 0; j < i; j++) {
                cout << s.substr(0, len / i);
                s.erase(0, len / i);
                cout << endl;
            }
            return 0;
        }
        if (len  / i <= 20) {
            long length = len / i;
            if (length * i < len)
                length++;
            cout << i << " " << length << endl;
            long x = length * i - len;
            for (int j = 0; j < i; j++) {
                if (x > 0) {
                    cout << s.substr(0, length - 1) << "*";
                    s.erase(0, length - 1);
                    cout << endl;
                    x--;
                }
                else {
                    cout << s.substr(0, length);
                    s.erase(0, length);
                    cout << endl;
                }
            }
            return 0;
        }
    }
}


#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    for (int z = 1; z <= 100; z++) {
        string s = "";
        for (int i = 0; i < z; i++)
            s += 'a';
        cout << z << endl;
        long len = s.size();
        for (int i = 1; i <= 5; i++) {
            if (len % i == 0 && len / i <= 20) {
                cout << i << " " << len / i << endl;
                for (int j = 0; j < i; j++) {
                    cout << s.substr(0, len / i);
                    s.erase(0, len / i);
                    cout << endl;
                }
                break;
            }
            if (len  / i <= 20) {
                long length = len / i;
                if (length * i < len)
                    length++;
                cout << i << " " << length << endl;
                long x = length * i - len;
                for (int j = 0; j < i; j++) {
                    if (x > 0) {
                        cout << s.substr(0, length - 1) << "*";
                        s.erase(0, length - 1);
                        cout << endl;
                        x--;
                    }
                    else {
                        cout << s.substr(0, length);
                        s.erase(0, length);
                        cout << endl;
                    }
                }
                break;
            }
        }
        cout << endl;
    }
}


#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    string s = "";
    cin >> s;
    long len = s.size();
    for (int i = 1; i <= 5; i++) {
        if (len % i == 0 && len / i <= 20) {
            cout << i << " " << len / i << endl;
            for (int j = 0; j < i; j++) {
                cout << s.substr(0, len / i);
                s.erase(0, len / i);
                cout << endl;
            }
            return 0;
        }
        if (len  / i <= 20) {
            long length = len / i;
            if (length * i < len)
                length++;
            if (length <= 20) {
                cout << i << " " << length << endl;
                long x = length * i - len;
                for (int j = 0; j < i; j++) {
                    if (x > 0) {
                        cout << s.substr(0, length - 1) << "*";
                        s.erase(0, length - 1);
                        cout << endl;
                        x--;
                    }
                    else {
                        cout << s.substr(0, length);
                        s.erase(0, length);
                        cout << endl;
                    }
                }
                return 0;
            }
        }
    }
}


#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    string s = "";
    cin >> s;
    long len = s.size();
    for (int i = 1; i <= 5; i++) {
        if (len % i == 0 && len / i <= 20) {
            cout << i << " " << len / i << endl;
            for (int j = 0; j < i; j++) {
                cout << s.substr(0, len / i);
                s.erase(0, len / i);
                cout << endl;
            }
            return 0;
        }
        if ((len + len % i) / i <= 20) {
            cout << i << " " << (len + len % i) / i << endl;
            long x = (len + len % i) / i * i - len;
            for (int j = 0; j < i; j++) {
                if (x > 0) {
                    cout << s.substr(0, (len + len % i) / i - 1) << "*";
                    s.erase(0, (len + len % i) / i - 1);
                    cout << endl;
                    x--;
                }
                else {
                    cout << s.substr(0, (len + len % i) / i);
                    s.erase(0, (len + len % i) / i);
                    cout << endl;
                }
            }
            return 0;
        }
    }

}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int a = s.length();
    if (a <=20)
        cout << s;
    else{
            int j;
    for (int i = 2; i <=5; i++) {
            if (((a / i <20)&&(a % i ==0))||(a / i < 19)){
                j = i;
                break;
            } }
        int ost =0;
        if (a % j !=0 ) {
            ost = j - (a % j);
        cout << j << " " << (a / j) +1 << endl;
        }
        else  cout << j << " " << (a / j) << endl;
        int c = 0;

        for(int i = 0; i < j; i++){
                if (ost > 0){
            cout << s.substr(c, a / j)<< "*" << endl;
            c+=a/j;
            ost--;
                }
                else {
            cout << s.substr(c, a / j + 1) << endl;
            c+=a/j;
                }
        }
    }
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int a = s.length();
    if (a <=20) {
            cout << 1 << " " << a << endl;
        cout << s;
    }
    else{
            int j;
    for (int i = 2; i <=5; i++) {
            if (((a / i <20)&&(a % i ==0))||(a / i < 19)){
                j = i;
                break;
            } }
        int ost =0;
        if (a % j !=0 ) {
            ost = j - (a % j);
        cout << j << " " << (a / j) +1 << endl;
        }
        else  cout << j << " " << (a / j) << endl;
        int c = 0;
        for(int i = 0; i < j; i++){
                if (ost > 0){
            cout << s.substr(c, a / j)<< "*" << endl;
            c+=a/j;
            ost--;
                }
                else {
                int r = a / j;
            if (a%j !=0)
            r ++;
            cout << s.substr(c, r) << endl;
            c+=r;
                }
        }
    }
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int a = s.length();
    if (a <=20) {
            cout << 1 << " " << a << endl;
        cout << s;
    }
    else{
            int j;
    for (int i = 2; i <=5; i++) {
            if ((a / i <20)){
                j = i;
                break;
            } }
        int ost =0;
        if (a % j !=0 ) {
            ost = j - (a % j);
        cout << j << " " << (a / j) +1 << endl;
        }
        else  cout << j << " " << (a / j) << endl;
        int c = 0;
        for(int i = 0; i < j; i++){
                if (ost > 0){
            cout << s.substr(c, a / j)<< "*" << endl;
            c+=a/j;
            ost--;
                }
                else {
                int r = a / j;
            if (a%j !=0)
            r ++;
            cout << s.substr(c, r) << endl;
            c+=r;
                }
        }
    }
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int a = s.length();
    cout << a << endl;
    if (a <=20) {
            cout << 1 << " " << a << endl;
        cout << s;
    }
    else{
            int j;
    for (int i = 2; i <=5; i++) {
            if ((a / i <20)){
                j = i;
                break;
            } }
        int ost =0;
        if (a % j !=0 ) {
            ost = j - (a % j);
        cout << j << " " << (a / j) +1 << endl;
        }
        else  cout << j << " " << (a / j) << endl;
        int c = 0;
        for(int i = 0; i < j; i++){
                if (ost > 0){
            cout << s.substr(c, a / j)<< "*" << endl;
            c+=a/j;
            ost--;
                }
                else {
                int r = a / j;
            if (a%j !=0)
            r ++;
            cout << s.substr(c, r) << endl;
            c+=r;
                }
        }
    }
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int a = s.length();
    if (a <=20) {
            cout << 1 << " " << a << endl;
        cout << s;
    }
    else{
            int j;
    for (int i = 2; i <=5; i++) {
            if ((a / i <=20)){
                j = i;
                break;
            } }
        int ost =0;
        if (a % j !=0 ) {
            ost = j - (a % j);
        cout << j << " " << (a / j) +1 << endl;
        }
        else  cout << j << " " << (a / j) << endl;
        int c = 0;
        for(int i = 0; i < j; i++){
                if (ost > 0){
            cout << s.substr(c, a / j)<< "*" << endl;
            c+=a/j;
            ost--;
                }
                else {
                int r = a / j;
            if (a%j !=0)
            r ++;
            cout << s.substr(c, r) << endl;
            c+=r;
                }
        }
    }
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int a = s.length();
    if (a <=20) {
            cout << 1 << " " << a << endl;
        cout << s;
    }
    else{
            int j;
    for (int i = 2; i <=5; i++) {
            if ((a / i <20)||((a / i == 20)&&(a % i == 0))){
                j = i;
                break;
            } }
        int ost =0;
        if (a % j !=0 ) {
            ost = j - (a % j);
        cout << j << " " << (a / j) +1 << endl;
        }
        else  cout << j << " " << (a / j) << endl;
        int c = 0;
        for(int i = 0; i < j; i++){
                if (ost > 0){
            cout << s.substr(c, a / j)<< "*" << endl;
            c+=a/j;
            ost--;
                }
                else {
                int r = a / j;
            if (a%j !=0)
            r ++;
            cout << s.substr(c, r) << endl;
            c+=r;
                }
        }
    }
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int a = s.length();
    if (a <=20) {
            cout << 1 << " " << a << endl;
        cout << s;
    }
    else{
            int j;
    for (int i = 2; i <=5; i++) {
            if (((a / i <20)&&(a % i ==0))||(a / i < 19)){
                j = i;
                break;
            } }
        int ost =0;
        if (a % j !=0 ) {
            ost = j - (a % j);
        cout << j << " " << (a / j) +1 << endl;
        }
        else  cout << j << " " << (a / j) << endl;
        int c = 0;

        for(int i = 0; i < j; i++){
                if (ost > 0){
            cout << "*" << s.substr(c, a / j)<< endl;
            c+=a/j;
            ost--;
                }
                else {
            cout << s.substr(c, a / j + 1) << endl;
            c+=a/j;
                }
        }
    }
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int a = s.length();
    if (a <=20) {
            cout << 1 << " " << a << endl;
        cout << s;
    }
    else{
            int j;
    for (int i = 2; i <=5; i++) {
            if (((a / i <20)&&(a % i ==0))||(a / i < 19)){
                j = i;
                break;
            } }
        int ost =0;
        if (a % j !=0 ) {
            ost = j - (a % j);
        cout << j << " " << (a / j) +1 << endl;
        }
        else  cout << j << " " << (a / j) << endl;
        int c = 0;

        for(int i = 0; i < j; i++){
                if (ost > 0){
            cout << "*" << s.substr(c, a / j)<< endl;
            c+=a/j;
            ost--;
                }
                else {
            cout << s.substr(c, a / j + 1) << endl;
            c+=a/j+1;
                }
        }
    }
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int a = s.length();
    if (a <=20) {
            cout << 1 << " " << a << endl;
        cout << s;
    }
    else{
            int j;
    for (int i = 2; i <=5; i++) {
            if (((a / i <20)&&(a % i ==0))||(a / i < 19)){
                j = i;
                break;
            } }
        int ost =0;
        if (a % j !=0 ) {
            ost = j - (a % j);
        cout << j << " " << (a / j) +1 << endl;
        }
        else  cout << j << " " << (a / j) << endl;
        int c = 0;

        for(int i = 0; i < j; i++){
                if (ost > 0){
            cout << "*" << s.substr(c, a / j)<< endl;
            c+=a/j;
            ost--;
            if (ost == 0)
                c++;
                }
                else {
            cout << s.substr(c, a / j + 1) << endl;
            c+=a/j+1;
                }
        }
    }
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int a = s.length();
    if (a <=20) {
            cout << 1 << " " << a << endl;
        cout << s;
    }
    else{
            int j;
    for (int i = 2; i <=5; i++) {
            if (((a / i <20)&&(a % i ==0))||(a / i < 19)){
                j = i;
                break;
            } }
        int ost =0;
        if (a % j !=0 ) {
            ost = j - (a % j);
        cout << j << " " << (a / j) +1 << endl;
        }
        else  cout << j << " " << (a / j) << endl;
        int c = 0;

        for(int i = 0; i < j; i++){
                if (ost > 0){
            cout << s.substr(c, a / j)<< "*" << endl;
            c+=a/j;
            ost--;
                }
                else {
            cout << s.substr(c, a / j + 1) << endl;
            c+=a/j;
                }
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#include <set>

using namespace std;

int main(){
    string s;
    cin >> s;
    int leng = s.length();
    int visota = 0, shirina = 0;
    if (leng <= 20){
        cout << 1 << " "<<  leng << "\n";
        cout << s;
    }
    else {
        visota = (leng - 1) / 20 + 1;
        shirina = (leng -1)/visota + 1;
        cout << visota << " " << shirina << "\n";
        int chet = visota * shirina - leng;
        int helper = chet / 3;
        //cout << helper << "\n";
        int ind = chet - chet / 3;
        int qwe = 0;
        for (int i = 0; i < ind; i ++){
                for (int j = 0; j <= helper; j ++){
                    cout << "*";
                }
                for (int j = 0; j < shirina - helper - 1; j ++){
                    cout << s[qwe];
                    qwe++;
                }
                cout << "\n";
        }
        for (int i = 0; i < visota - ind; i ++){
                for (int j = 0; j < helper; j ++){
                    cout << "*";
                }
                for (int j = 0; j <= shirina - helper - 1 ; j ++){
                    cout << s[qwe];
                    qwe++;
                }
                cout << "\n";
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#include <set>

using namespace std;

int main(){
    string s;
    cin >> s;
    int leng = s.length();
    int visota = 0, shirina = 0;
    if (leng <= 20){
        cout << 1 << " "<<  leng << "\n";
        cout << s;
    }
    else {
        visota = (leng - 1) / 20 + 1;
        shirina = (leng -1)/visota + 1;
        cout << visota << " " << shirina << "\n";
        int chet = visota * shirina - leng;
        int helper = chet / 3;
        int ind = chet - chet / 3;
        int qwe = 0;
        for (int i = 0; i < ind; i ++){
                for (int j = 0; j <= helper; j ++){
                    cout << "*";
                }
                for (int j = 0; j < shirina - chet; j ++){
                    cout << s[qwe];
                    qwe++;
                }
                cout << "\n";
        }
        for (int i = 0; i < visota - ind; i ++){
                for (int j = 0; j < helper; j ++){
                    cout << "*";
                }
                for (int j = 0; j < shirina - chet + 1; j ++){
                    cout << s[qwe];
                    qwe++;
                }
                cout << "\n";
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#include <set>

using namespace std;

int main(){
    string s;
    cin >> s;
    int leng = s.length();
    int visota = 0, shirina = 0;
    if (leng <= 20){
        cout << 1 << " "<<  leng << "\n";
        cout << s;
        return 0;
    }
    else {
        visota = (leng - 1) / 20 + 1;
        shirina = (leng - 1)/visota + 1;
        cout << visota << " " << shirina << "\n";
        int chet = visota * shirina - leng;
        int helper = chet / 3;
        //cout << helper << "\n";
        int ind = chet - helper * visota;
        int qwe = 0;
        for (int i = 0; i < ind; i ++){
                for (int j = 0; j <= helper; j ++){
                    cout << "*";
                }
                for (int j = 0; j < shirina - helper - 1; j ++){
                    cout << s[qwe];
                    qwe++;
                }
                cout << "\n";
        }
        for (int i = 0; i < visota - ind; i ++){
                for (int j = 0; j < helper; j ++){
                    cout << "*";
                }
                for (int j = 0; j <= shirina - helper - 1 ; j ++){
                    cout << s[qwe];
                    qwe++;
                }
                cout << "\n";
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
string s;
cin >> s;
int n = s.size();
int c = (n + 19) / 20;
int len = 20;
while (len * c - n > c - 1) {
        len--;
}
int ul = len * c - n;
int now = 0;
string t = s;
int f = 1;
for (int i = 0; i < n; ++i) {
if ((i + 1) % len == 0) {
++now;
f = 1;
}
if (now + 1 <= ul && f) {
t.insert(i + 1, "*");
f = 0;
}
}
cout << c <<  ' ' << len << endl;
int j = 0;
for (int i = 0; i < t.size(); ++i) {
cout<< t[i];
if ((i + 1) % len == 0) {
cout<< endl;
}
}
return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

int32_t main()
{
	string s;
	cin >> s;
	for(int row = 1; row <= 5; row++)
	{
		int col = (s.size() + row - 1) / row;
		if(col <= 20)
		{
			cout << row << " " << col << endl;
			int asterik = row * col - s.size();
			int k = 0;
			int per_row = asterik / row;
			for(int i = 0; i < row; i++)
			{
				int cnt = 0;
				if(i == row - 1) per_row = asterik;
				for(int j = 0; j < col; j++)
				{
					if(cnt < per_row) cout << "*", cnt++;
					else cout << s[k++];
				}
				cout << endl;
				asterik -= per_row;
			}
			return 0;
		}
	}
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

int32_t main()
{
	string s;
	cin >> s;
	for(int row = 1; row <= 5; row++)
	{
		int col = (s.size() + row - 1) / row;
		if(col <= 20)
		{
			cout << row << " " << col << endl;
			int asterik = row * col - s.size();
			int k = 0;
			int per_row = (asterik + row - 1) / row;
			for(int i = 0; i < row; i++)
			{
				int cnt = 0;
				per_row = min(asterik, per_row);
				for(int j = 0; j < col; j++)
				{
					if(cnt < per_row) cout << "*", cnt++;
					else cout << s[k++];
				}
				cout << endl;
				asterik -= per_row;
			}
			return 0;
		}
	}
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

int32_t main()
{
	string s;
	cin >> s;
	for(int row = 1; row <= 5; row++)
	{
		int col = (s.size() + row - 1) / row;
		if(col <= 20)
		{
			cout << row << " " << col << endl;
			int asterik = row * col - s.size();
			int k = 0;
			int per_row = (asterik + row - 1) / row;
			for(int i = 0; i < row; i++)
			{
				int cnt = 0;
				if(i == row - 1) per_row = asterik;
				for(int j = 0; j < col; j++)
				{
					if(cnt < per_row) cout << "*", cnt++;
					else cout << s[k++];
				}
				cout << endl;
				asterik -= per_row;
			}
			return 0;
		}
	}
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;

int main()
{
    string s;
    cin>>s;
    int len,len1,i,j,k=0,ans,x,y,z=0;
    len=s.length();

    if(len<=20)
    {
        cout<<"1 "<<len<<endl;;
        cout<<s<<endl;
        return 0;
    }

    for(i=2;i<=5;i++)
    {
        ans=len/i;
        if(ans<=20)
            break;
    }
    len1=i*ans;

    if(len1==len)
    {
        cout<<i<<" "<<ans<<endl;
        for(j=1;j<=i;j++)
        {
            for(k=k;k<j*ans;k++)
            {
                cout<<s[k];
            }
            cout<<endl;
        }
    }
    else if(len1!=len)
    {
        x=ans+1;
        cout<<i<<" "<<x<<endl;
        y=(i*x)-len;
        for(j=1;j<=i;j++)
        {
            if(y>0)
            {
                cout<<"*";
                y-=1;
                z+=1;

            }
            for(k=k;k<(j*x)-z;k++)
            {
                cout<<s[k];
            }
            if(j!=i) printf("\n");
        }
    }
    return 0;

}


#include<iostream>
#include<string.h>
using namespace std;

int main()
{
    string s;
    cin>>s;
    int len,len1,i,j,k=0,ans,x,y,z;
    len=s.length();

    if(len<=20)
    {
        cout<<"1 "<<len<<endl;;
        cout<<s<<endl;
        return 0;
    }

    for(i=2;i<=5;i++)
    {
        ans=len/i;
        if(ans<=20)
            break;
    }
    len1=i*ans;

    if(len1==len)
    {
        cout<<i<<" "<<ans<<endl;
        for(j=0;j<=i;j++)
        {
            for(k=j*ans;k<(j+1)*ans;k++)
            {
                cout<<s[k];
            }
            cout<<endl;
        }
    }
    else if(len1!=len)
    {
        x=ans+1;
        cout<<i<<" "<<x<<endl;
        y=(i*x)-len;
        for(j=0;j<=i;j++)
        {
            if(y>0)
            {
                cout<<"*";
                y-=1;
                z=1;

            }
            for(k=k;k<((j+1)*x)-z;k++)
            {
                cout<<s[k];
            }
            cout<<endl;
        }
    }

}


#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;

int main()
{
    string s;
    cin>>s;
    int len,len1,i,j,k=0,ans,x,y,z=0;
    len=s.length();

    if(len<=20)
    {
        cout<<"1 "<<len<<endl;;
        cout<<s<<endl;
        return 0;
    }

    for(i=2;i<=5;i++)
    {
        ans=len/i;
        if(ans<=20)
            break;
    }
    len1=i*ans;

    if(len1==len)
    {
        cout<<i<<" "<<ans<<endl;
        for(j=1;j<=i;j++)
        {
            for(k=k;k<j*ans;k++)
            {
                cout<<s[k];
            }
            cout<<endl;
        }
    }
    else if(len1!=len)
    {
        if(ans<20)
        {
            x=ans+1;
        }
        else {
            i+=1;
            if(len%i==0)
                x=len/i;
            else x=(len/i)+1;
        }
        cout<<i<<" "<<x<<endl;
        y=(i*x)-len;
        for(j=1;j<=i;j++)
        {
            if(y>0)
            {
                cout<<"*";
                y-=1;
                z+=1;

            }
            for(k=k;k<(j*x)-z;k++)
            {
                cout<<s[k];
            }
            if(j!=i) printf("\n");
        }
    }
    return 0;

}


#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;

int main()
{
    string s;
    cin>>s;
    int len,len1,i,j,k=0,ans,x,y,z;
    len=s.length();

    if(len<=20)
    {
        cout<<"1 "<<len<<endl;;
        cout<<s<<endl;
        return 0;
    }

    for(i=2;i<=5;i++)
    {
        ans=len/i;
        if(ans<=20)
            break;
    }
    len1=i*ans;

    if(len1==len)
    {
        cout<<i<<" "<<ans<<endl;
        for(j=0;j<=i;j++)
        {
            for(k=j*ans;k<(j+1)*ans;k++)
            {
                cout<<s[k];
            }
            cout<<endl;
        }
    }
    else if(len1!=len)
    {
        x=ans+1;
        cout<<i<<" "<<x<<endl;
        y=(i*x)-len;
        for(j=0;j<=i;j++)
        {
            if(y>0)
            {
                cout<<"*";
                y-=1;
                z=1;

            }
            for(k=k;k<((j+1)*x)-z;k++)
            {
                cout<<s[k];
            }
            if(j!=i) printf("\n");
        }
    }

}


#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;

int main()
{
    string s;
    cin>>s;
    int len,len1,i,j,k=0,ans,x,y,z;
    len=s.length();

    if(len<=20)
    {
        cout<<"1 "<<len<<endl;;
        cout<<s<<endl;
        return 0;
    }

    for(i=2;i<=5;i++)
    {
        ans=len/i;
        if(ans<=20)
            break;
    }
    len1=i*ans;

    if(len1==len)
    {
        cout<<i<<" "<<ans<<endl;
        for(j=1;j<=i;j++)
        {
            for(k=k;k<j*ans;k++)
            {
                cout<<s[k];
            }
            cout<<endl;
        }
    }
    else if(len1!=len)
    {
        x=ans+1;
        cout<<i<<" "<<x<<endl;
        y=(i*x)-len;
        for(j=1;j<=i;j++)
        {
            if(y>0)
            {
                cout<<"*";
                y-=1;
                z=1;

            }
            for(k=k;k<(j*x)-z;k++)
            {
                cout<<s[k];
            }
            if(j!=i) printf("\n");
        }
    }
    return 0;

}


#include<iostream>
#include<string.h>
using namespace std;

int main()
{
    string s;
    cin>>s;
    int len,len1,i,j,k=0,ans,x,y,z;
    len=s.length();

    if(len<=20)
    {
        cout<<"1 "<<len<<endl;;
        cout<<s<<endl;
        return 0;
    }

    for(i=2;i<=5;i++)
    {
        ans=len/i;
        if(ans<=20)
            break;
    }
    len1=i*ans;

    if(len1==len)
    {
        cout<<i<<" "<<ans<<endl;
        for(j=0;j<=i;j++)
        {
            for(k=j*ans;k<(j+1)*ans;k++)
            {
                cout<<s[k];
            }
            cout<<endl;
        }
    }
    else if(len1!=len)
    {
        x=ans+1;
        cout<<i<<" "<<x<<endl;
        y=(i*x)-len;
        for(j=0;j<=i;j++)
        {
            if(y>0)
            {
                cout<<"*";
                y-=1;
                z=1;

            }
            for(k=k;k<((j+1)*x)-z;k++)
            {
                cout<<s[k];
            }
            if(j!=i) cout<<endl;
        }
    }

}


#include<string>
#include<cmath>
#include<iostream>

using std::cin;
using std::cout;

int main(){
	std::string s;
	cin>>s;
	int n,nr,nc;
	n = s.size();
	nr = n%20==0?n/20:(n/20)+1;
	nc = n%nr==0?n/nr:(n/nr)+1;
	cout<<nr<<" "<<nc<<"\n";
	int ex = nc*nr - n;
	int i = 0;
	for(int t=0;t<nr;t++){
		for(int k=0;k<nc-2;k++){
			cout<<s[i++];
		}
		if(i>=n) break;
		if(ex > 0) {
			cout<<"*";
			ex--;
		}
		else cout<<s[i++];
		if(i>=n) break;
		if(ex > 0){
			cout<<"*";
			ex--;
		}
		else cout<<s[i++];
	cout<<"\n";
	}

	return 0;
}


#include<string>
#include<cmath>
#include<iostream>

using std::cin;
using std::cout;

int main(){
	std::string s;
	cin>>s;
	int n,nr,nc;
	n = s.size();
	nr = n%20==0?n/20:(n/20)+1;
	nc = n%nr==0?n/nr:(n/nr)+1;
	cout<<nr<<" "<<nc<<"\n";
	int ex = nc*nr - n;
	int i = 0;
	for(int t=0;t<nr;t++){
		for(int k=0;k<nc-1;k++){
			cout<<s[i++];
		}
		if(i>=n) break;
		if(ex > 0) {
			cout<<"*";
			ex--;
		}
		else cout<<s[i++];
	cout<<"\n";
	}

	return 0;
}


#include<string>
#include<cmath>
#include<iostream>

using std::cin;
using std::cout;

int main(){
	std::string s;
	cin>>s;
	int n,nr,nc;
	n = s.size();
	nr = n%20==0?n/20:(n/20)+1;
	nc = n%nr==0?n/nr:(n/nr)+1;
	cout<<nr<<" "<<nc<<"\n";
	int ex = nc*nr - n;
	int i = 0;
	for(int t=0;t<nr;t++){
		for(int k=0;k<nc-2;k++){
			cout<<s[i++];
		}
		if(ex > 0) {
			cout<<"*";
			ex--;
		}
		else cout<<s[i++];
		if(ex > 0){
			cout<<"*";
			ex--;
		}
		else cout<<s[i++];
	cout<<"\n";
	}

	return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll int, ll int>
#define vi vector<int>
#define vl vector<ll int>
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define debug(n) cerr << "DEBUG1 " << n << "\n";
#define debug2(n, m) cerr << "DEBUG2 " << n << ' ' << m << "\n";
#define debug3(n, m, x) cerr << "DEBUG3 " << n << ' ' << m << ' ' << x << "\n";
#define debug4(n, m, x, y) cerr << "DEBUG4 " << n << ' ' << m << ' ' << x << ' ' << y << "\n";
#define ss_def stringstream ss // stringstream, do ss_def(str), then ss >> n (n is int)
#define upzero(n) if (n < 0) n = 0
#define alive(n) cout << "Alive here: checkpoint " << n << endl
#pragma GCC optimize("Ofast")
// header
using namespace std;
// constant ints
// quick functions
void yes() {
	cout << "YES\n";
	return;
}
void no() {
	cout << "NO\n";
	return;
}
void out(ll int n) {
	cout << n << endl;
	return;
}
void outs(string str) {
	cout << str << endl;
	return;
}
// no headers for u don't rely :(
void init() {
	// initialize

}
void solve(int case_no) {
    // implementation
    string str;
    cin >> str;
    int strl = str.length();
    int row = strl / 20 + bool(strl % 20);
    int col = strl / row + bool(strl % row);
    cout << row << ' ' << col << endl;
    int rem = (row - strl % row) % row;
    int cnt = 0;
    for (int i = 1;i <= row;i++) {
    	if (rem >= i) cout << "*";
    	for (int j = 1;j <= col;j++) {
    		if (rem >= i && j == 1) continue;
    		cout << str[cnt];
    		cnt++;
		}
		cout << endl;
	}
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    srand(time(NULL));
    init();
    int t = 1;
//    cin >> t;
    for (int i = 1;i <= t;i++) solve(i);
}
/*

*/


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll int, ll int>
#define vi vector<int>
#define vl vector<ll int>
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define debug(n) cerr << "DEBUG1 " << n << "\n";
#define debug2(n, m) cerr << "DEBUG2 " << n << ' ' << m << "\n";
#define debug3(n, m, x) cerr << "DEBUG3 " << n << ' ' << m << ' ' << x << "\n";
#define debug4(n, m, x, y) cerr << "DEBUG4 " << n << ' ' << m << ' ' << x << ' ' << y << "\n";
#define ss_def stringstream ss // stringstream, do ss_def(str), then ss >> n (n is int)
#define upzero(n) if (n < 0) n = 0
#define alive(n) cout << "Alive here: checkpoint " << n << endl
#pragma GCC optimize("Ofast")
// header
using namespace std;
// constant ints
// quick functions
void yes() {
	cout << "YES\n";
	return;
}
void no() {
	cout << "NO\n";
	return;
}
void out(ll int n) {
	cout << n << endl;
	return;
}
void outs(string str) {
	cout << str << endl;
	return;
}
// no headers for u don't rely :(
void init() {
	// initialize

}
void solve(int case_no) {
    // implementation
    string str;
    cin >> str;
    int strl = str.length();
    int row = strl / 20 + bool(strl % 20);
    int col = strl / row + bool(strl % row);
    cout << row << ' ' << col << endl;
    int rem = strl % row;
    int cnt = 0;
    for (int i = 1;i <= row;i++) {
    	if (rem >= i) cout << "*";
    	for (int j = 1;j <= col;j++) {
    		if (rem >= i && j == 1) continue;
    		cout << str[cnt];
    		cnt++;
		}
		cout << endl;
	}
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    srand(time(NULL));
    init();
    int t = 1;
//    cin >> t;
    for (int i = 1;i <= t;i++) solve(i);
}
/*

*/


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll int, ll int>
#define vi vector<int>
#define vl vector<ll int>
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define debug(n) cerr << "DEBUG1 " << n << "\n";
#define debug2(n, m) cerr << "DEBUG2 " << n << ' ' << m << "\n";
#define debug3(n, m, x) cerr << "DEBUG3 " << n << ' ' << m << ' ' << x << "\n";
#define debug4(n, m, x, y) cerr << "DEBUG4 " << n << ' ' << m << ' ' << x << ' ' << y << "\n";
#define ss_def stringstream ss // stringstream, do ss_def(str), then ss >> n (n is int)
#define upzero(n) if (n < 0) n = 0
#define alive(n) cout << "Alive here: checkpoint " << n << endl
#pragma GCC optimize("Ofast")
// header
using namespace std;
// constant ints
// quick functions
void yes() {
	cout << "YES\n";
	return;
}
void no() {
	cout << "NO\n";
	return;
}
void out(ll int n) {
	cout << n << endl;
	return;
}
void outs(string str) {
	cout << str << endl;
	return;
}
// no headers for u don't rely :(
void init() {
	// initialize

}
void solve(int case_no) {
    // implementation
    string str;
    cin >> str;
    int strl = str.length();
    int len = strl / 5 + bool(strl % 5);
    cout << "5 " << len << endl;
    int rem = strl % 5;
    int cnt = 0;
    for (int i = 1;i <= 5;i++) {
    	if (rem >= i) cout << "*";
    	for (int j = 1;j <= len - (rem >= i);j++) {
    		cout << str[cnt];
    		cnt++;
		}
		cout << endl;
	}
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    srand(time(NULL));
    init();
    int t = 1;
//    cin >> t;
    for (int i = 1;i <= t;i++) solve(i);
}
/*

*/


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll int, ll int>
#define vi vector<int>
#define vl vector<ll int>
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define debug(n) cerr << "DEBUG1 " << n << "\n";
#define debug2(n, m) cerr << "DEBUG2 " << n << ' ' << m << "\n";
#define debug3(n, m, x) cerr << "DEBUG3 " << n << ' ' << m << ' ' << x << "\n";
#define debug4(n, m, x, y) cerr << "DEBUG4 " << n << ' ' << m << ' ' << x << ' ' << y << "\n";
#define ss_def stringstream ss // stringstream, do ss_def(str), then ss >> n (n is int)
#define upzero(n) if (n < 0) n = 0
#define alive(n) cout << "Alive here: checkpoint " << n << endl
#pragma GCC optimize("Ofast")
// header
using namespace std;
// constant ints
// quick functions
void yes() {
	cout << "YES\n";
	return;
}
void no() {
	cout << "NO\n";
	return;
}
void out(ll int n) {
	cout << n << endl;
	return;
}
void outs(string str) {
	cout << str << endl;
	return;
}
// no headers for u don't rely :(
void init() {
	// initialize

}
void solve(int case_no) {
    // implementation
    string str;
    cin >> str;
    int strl = str.length();
    for (int i = 1;i <= 5;i++) {
    	if (strl % i == 0 && strl / i <= 20) {
    		cout << i << ' ' << strl / i << endl;
    		for (int j = 0;j < i;j++) {
    			cout << str.substr(j * (strl / i), (strl / i)) << endl;
			}
		}
	}
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    srand(time(NULL));
    init();
    int t = 1;
//    cin >> t;
    for (int i = 1;i <= t;i++) solve(i);
}
/*

*/


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll int, ll int>
#define vi vector<int>
#define vl vector<ll int>
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define debug(n) cerr << "DEBUG1 " << n << "\n";
#define debug2(n, m) cerr << "DEBUG2 " << n << ' ' << m << "\n";
#define debug3(n, m, x) cerr << "DEBUG3 " << n << ' ' << m << ' ' << x << "\n";
#define debug4(n, m, x, y) cerr << "DEBUG4 " << n << ' ' << m << ' ' << x << ' ' << y << "\n";
#define ss_def stringstream ss // stringstream, do ss_def(str), then ss >> n (n is int)
#define upzero(n) if (n < 0) n = 0
#define alive(n) cout << "Alive here: checkpoint " << n << endl
#pragma GCC optimize("Ofast")
// header
using namespace std;
// constant ints
// quick functions
void yes() {
	cout << "YES\n";
	return;
}
void no() {
	cout << "NO\n";
	return;
}
void out(ll int n) {
	cout << n << endl;
	return;
}
void outs(string str) {
	cout << str << endl;
	return;
}
// no headers for u don't rely :(
void init() {
	// initialize

}
void solve(int case_no) {
    // implementation
    string str;
    cin >> str;
    int strl = str.length();
    int len = strl / 5 + bool(strl % 5);
    cout << "5 " << len << endl;
    int rem = strl % 5 + 1;
    int cnt = 0;
    for (int i = 1;i <= 5;i++) {
    	if (rem >= i) cout << "*";
    	for (int j = 1;j <= len - (rem >= i);j++) {
    		cout << str[cnt];
    		cnt++;
		}
		cout << endl;
	}
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    srand(time(NULL));
    init();
    int t = 1;
//    cin >> t;
    for (int i = 1;i <= t;i++) solve(i);
}
/*

*/


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll int, ll int>
#define vi vector<int>
#define vl vector<ll int>
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define debug(n) cerr << "DEBUG1 " << n << "\n";
#define debug2(n, m) cerr << "DEBUG2 " << n << ' ' << m << "\n";
#define debug3(n, m, x) cerr << "DEBUG3 " << n << ' ' << m << ' ' << x << "\n";
#define debug4(n, m, x, y) cerr << "DEBUG4 " << n << ' ' << m << ' ' << x << ' ' << y << "\n";
#define ss_def stringstream ss // stringstream, do ss_def(str), then ss >> n (n is int)
#define upzero(n) if (n < 0) n = 0
#define alive(n) cout << "Alive here: checkpoint " << n << endl
#pragma GCC optimize("Ofast")
// header
using namespace std;
// constant ints
// quick functions
void yes() {
	cout << "YES\n";
	return;
}
void no() {
	cout << "NO\n";
	return;
}
void out(ll int n) {
	cout << n << endl;
	return;
}
void outs(string str) {
	cout << str << endl;
	return;
}
// no headers for u don't rely :(
void init() {
	// initialize

}
void solve(int case_no) {
    // implementation
    string str;
    cin >> str;
    int strl = str.length();
    int len = strl / 5 + bool(strl % 5);
    cout << len << " 5\n";
    int rem = strl % 5 + 1;
    int cnt = 0;
    for (int i = 1;i <= 5;i++) {
    	if (rem >= i) cout << "*";
    	for (int j = 1;j <= len - (rem >= i);j++) {
    		cout << str[cnt];
    		cnt++;
		}
		cout << endl;
	}
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    srand(time(NULL));
    init();
    int t = 1;
//    cin >> t;
    for (int i = 1;i <= t;i++) solve(i);
}
/*

*/


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll int, ll int>
#define vi vector<int>
#define vl vector<ll int>
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define debug(n) cerr << "DEBUG1 " << n << "\n";
#define debug2(n, m) cerr << "DEBUG2 " << n << ' ' << m << "\n";
#define debug3(n, m, x) cerr << "DEBUG3 " << n << ' ' << m << ' ' << x << "\n";
#define debug4(n, m, x, y) cerr << "DEBUG4 " << n << ' ' << m << ' ' << x << ' ' << y << "\n";
#define ss_def stringstream ss // stringstream, do ss_def(str), then ss >> n (n is int)
#define upzero(n) if (n < 0) n = 0
#define alive(n) cout << "Alive here: checkpoint " << n << endl
#pragma GCC optimize("Ofast")
// header
using namespace std;
// constant ints
// quick functions
void yes() {
	cout << "YES\n";
	return;
}
void no() {
	cout << "NO\n";
	return;
}
void out(ll int n) {
	cout << n << endl;
	return;
}
void outs(string str) {
	cout << str << endl;
	return;
}
// no headers for u don't rely :(
void init() {
	// initialize

}
void solve(int case_no) {
    // implementation
    string str;
    cin >> str;
    int strl = str.length();
    int len = strl / 5 + bool(strl % 5);
    cout << << len << " 5\n";
    int rem = strl % 5 + 1;
    int cnt = 0;
    for (int i = 1;i <= 5;i++) {
    	if (rem >= i) cout << "*";
    	for (int j = 1;j <= len - (rem >= i);j++) {
    		cout << str[cnt];
    		cnt++;
		}
		cout << endl;
	}
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    srand(time(NULL));
    init();
    int t = 1;
//    cin >> t;
    for (int i = 1;i <= t;i++) solve(i);
}
/*

*/


#include<bits/stdc++.h>
#define int ll

using namespace std;

typedef long long ll;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    int charn = 0, n = s.size();
    if (n <= 15) {
        cout << 1 << " " << n << "\n" << s;
        return 0;
    }
    for (int i = 2; i <= 5; i++) {
        int k = n / i;
        int d = n % i;
        if (k > 15) continue;
        cout << i << " " << n/i + (n % i != 0) << "\n";
        for (int j = 0; j < i; j++) {
            int cnt = 0;
            for (int z = 0; z < (n / i + (d > 0 && n % i != 0)); z++) {
                cout << s[charn];
                charn++;
                cnt++;
            }
            d--;
            for (int z = cnt; z < n / i + (n % i != 0); z++) {
                cout << "*";
            }
            cout << "\n";
        }
        return 0;
    }
    return 0;
}


#include<bits/stdc++.h>
#define int ll

using namespace std;

typedef long long ll;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    int charn = 0, n = s.size();
    if (n <= 25) {
        cout << 1 << " " << n << "\n" << s;
        return 0;
    }
    for (int i = 2; i <= 5; i++) {
        int k = n / i;
        int d = n % i;
        if (k > 15) continue;
        cout << i << " " << n/i + (n % i != 0) << "\n";
        for (int j = 0; j < i; j++) {
            int cnt = 0;
            for (int z = 0; z < (n / i + 1 - (d == 0)); z++) {
                cout << s[charn];
                charn++;

                cnt++;
            }
            d--;
            for (int z = cnt; z < 15; z++) {
                cout << "*";
            }
            cout << "\n";
        }
        return 0;
    }
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int a = s.length();
    if (a <=20) {
            cout << 1 << " " << a << endl;
        cout << s;
    }
    else{
            int j;
    for (int i = 2; i <=5; i++) {
            if ((a / i + (a % i != 0) <=20)){
                j = i;
                break;
            } }
        int ost =0;
        if (a % j !=0 ) {
            ost = j - (a % j);
        cout << j << " " << (a / j) +1 << endl;
        }
        else  cout << j << " " << (a / j) << endl;
        int c = 0;
        for(int i = 0; i < j; i++){
                if (ost > 0){
            cout << s.substr(c, a / j)<< "*" << endl;
            c+=a/j;
            ost--;
                }
                else {
                int r = a / j;
            if (a%j !=0)
            r ++;
            cout << s.substr(c, r) << endl;
            c+=r;
                }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
#define int ll

using namespace std;

typedef long long ll;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    int charn = 0, n = s.size();
    if (n <= 15) {
        cout << 1 << " " << n << "\n" << s;
        return 0;
    }
    for (int i = 2; i <= 5; i++) {
        int k = n / i;
        int d = n % i;
        if (k > 15) continue;
        cout << i << " " << n/i + (n % i != 0) << "\n";
        for (int j = 0; j < i; j++) {
            int cnt = 0;
            for (int z = 0; z < (n / i + 1 - (d == 0)); z++) {
                cout << s[charn];
                charn++;

                cnt++;
            }
            d--;
            for (int z = cnt; z < 15; z++) {
                cout << "*";
            }
            cout << "\n";
        }
        return 0;
    }
    return 0;
}