#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
#include <tuple>
#include <typeinfo>
#include <unordered_set>
#include <unordered_map>
#include <vector>
using namespace std;

#define REP2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define REP(i, n) REP2(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
#define PB(e) push_back(e)
#define FOREACH(i, c) for(auto i = (c).begin(); i != (c).end(); ++i)
#define MP(a, b) make_pair(a, b)
#define BIT(n, m) (((n) >> (m)) & 1)

typedef long long ll;

const ll inf = 1e15;
const ll mod = 1000 * 1000 * 1000 + 7;

int main(){
    int n;
    cin >> n;

    vector<int> D(2 * n), F(2 * n);

    int add   = 0;
    int czero = 0;

    REP(i, n * 2){
        scanf("%d.%d", &D[i], &F[i]);
        add -= F[i];
        if(F[i] == 0){
            czero++;
        }
    }

    add += max(0, 2 * n - 2 * czero) / 2 * 1000;

    int amin = add;
    int amax = add + czero * 1000;
    int best = 1e8;

    for(int c = amin; c <= amax; c += 1000){
        if(abs(c) <= best){
            best = abs(c);
        }
    }

    printf("%d.%03d\n", best / 1000, best % 1000);
    return 0;
}


#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pLL;
double a[8005], b[8005], c[8005];
int main() {
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  n *= 2;
  int n2 = n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    a[i] -= int(a[i]);
  }
  sort(a + 1, a + n + 1);
  int idx = 1;
  while (a[idx++] == 0) a[++n] = 1;
  a[n + 1] = 1;
  for (int i = 1; i <= n; ++i) b[i] = b[i - 1] + a[i];
  for (int i = n; i >= 1; --i) c[i] = c[i + 1] + 1 - a[i];
  double best = abs(b[n2 / 2] - c[n2 / 2 + 1]);
  for (int i = n2 / 2 + 1; i + n2 / 2 <= n; ++i)
    best = min(best, abs(b[i] - c[i + 1]));
  cout << fixed << setprecision(3) << best;
}


#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pLL;
double a[8005], b[8005], c[8005];
int main() {
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  n *= 2;
  int n2 = n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    a[i] -= int(a[i]);
  }
  sort(a + 1, a + n + 1);
  int idx = 1;
  while (a[idx++] == 0) a[++n] = 1;
  a[n + 1] = 1;
  for (int i = 1; i <= n; ++i) b[i] = b[i - 1] + a[i];
  for (int i = n; i >= 1; --i) c[i] = c[i + 1] + 1 - a[i];
  double best = abs(b[n2 / 2] - c[n2 / 2 + 1]);
  for (int i = n2 / 2 + 1; i + n2 / 2 <= n; ++i)
    best = min(best, abs(b[i] - c[i + 1]));
  cout << best;
}


#include <bits/stdc++.h>
using namespace std;
#define TR(i,v)         for(__typeof((v).begin())i=(v).begin();i!=(v).end();++i)
#define DEBUG(x)        cout << #x << " = " << x << endl;
#define SIZE(p)         (int)(p).size()
#define MP(a, b)        make_pair((a), (b))
#define ALL(p)          (p).begin(), (p).end()
#define rep(i, n)       for(int (i)=0; (i)<(int)(n); ++(i))
#define REP(i, a, n)    for(int (i)=(a); (i)<(int)(n); ++(i))
#define FOR(i, a, b)    for(int (i)=(int)(a); (i)<=(int)(b); ++(i))
#define FORD(i, b, a)   for(int (i)=(int)(b); (i)>=(int)(a); --(i))
#define CLR(x, y)       memset((x), (y), sizeof((x)))
typedef long long LL;
typedef pair<int, int> pii;
inline LL Abs(LL x) {
    return x<0?-x:x;
}
int main(int argc, char const *argv[]) {
#ifndef ONLINE_JUDGE
    freopen("A.in", "r", stdin);
    // freopen("out", "w", stdout);
#endif
    // ios::sync_with_stdio(false);     cin.tie(0);
    LL A=0,B=0;
    int n;  scanf("%d",&n);
    int c1=0,c2=0;
    rep(i,n+n) {
        int a,b;    scanf("%d.%d",&a,&b);
        if(!b)  ++c1;
        else    ++c2;
        A+=a*1000+b,B+=a*1000;
    }
    LL res=~0ULL>>1;
    FOR(i,0,min(c1,n)) if(n-i>=0 && n-i<=c2) {
        LL t=B+(LL)(n-i)*1000;
        res=min(res,Abs(A-t));
    }
    printf("%lld.%03lld\n",res/1000,res%1000);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define TR(i,v)         for(__typeof((v).begin())i=(v).begin();i!=(v).end();++i)
#define DEBUG(x)        cout << #x << " = " << x << endl;
#define SIZE(p)         (int)(p).size()
#define MP(a, b)        make_pair((a), (b))
#define ALL(p)          (p).begin(), (p).end()
#define rep(i, n)       for(int (i)=0; (i)<(int)(n); ++(i))
#define REP(i, a, n)    for(int (i)=(a); (i)<(int)(n); ++(i))
#define FOR(i, a, b)    for(int (i)=(int)(a); (i)<=(int)(b); ++(i))
#define FORD(i, b, a)   for(int (i)=(int)(b); (i)>=(int)(a); --(i))
#define CLR(x, y)       memset((x), (y), sizeof((x)))
typedef long long LL;
typedef pair<int, int> pii;

int main(int argc, char const *argv[]) {
#ifndef ONLINE_JUDGE
    freopen("A.in", "r", stdin);
    // freopen("out", "w", stdout);
#endif
    // ios::sync_with_stdio(false);     cin.tie(0);
    LL A=0,B=0;
    int n;  scanf("%d",&n);
    int c1=0,c2=0;
    rep(i,n+n) {
        int a,b;    scanf("%d.%d",&a,&b);
        if(!b)  ++c1;
        else    ++c2;
        A+=a*1000+b,B+=a*1000;
    }
    LL res=abs(A-B);
    FOR(i,0,min(c1,n)) if(n-i>=0 && n-i<=c2) {
        LL t=B+(LL)(n-i)*1000;
        res=min(res,abs(A-t));
    }
    printf("%lld.%lld\n",res/1000,res%1000);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define TR(i,v)         for(__typeof((v).begin())i=(v).begin();i!=(v).end();++i)
#define DEBUG(x)        cout << #x << " = " << x << endl;
#define SIZE(p)         (int)(p).size()
#define MP(a, b)        make_pair((a), (b))
#define ALL(p)          (p).begin(), (p).end()
#define rep(i, n)       for(int (i)=0; (i)<(int)(n); ++(i))
#define REP(i, a, n)    for(int (i)=(a); (i)<(int)(n); ++(i))
#define FOR(i, a, b)    for(int (i)=(int)(a); (i)<=(int)(b); ++(i))
#define FORD(i, b, a)   for(int (i)=(int)(b); (i)>=(int)(a); --(i))
#define CLR(x, y)       memset((x), (y), sizeof((x)))
typedef long long LL;
typedef pair<int, int> pii;
inline LL Abs(LL x) {
    return x<0?-x:x;
}
int main(int argc, char const *argv[]) {
#ifndef ONLINE_JUDGE
    freopen("A.in", "r", stdin);
    // freopen("out", "w", stdout);
#endif
    // ios::sync_with_stdio(false);     cin.tie(0);
    LL A=0,B=0;
    int n;  scanf("%d",&n);
    int c1=0,c2=0;
    rep(i,n+n) {
        int a,b;    scanf("%d.%d",&a,&b);
        if(!b)  ++c1;
        else    ++c2;
        A+=a*1000+b,B+=a*1000;
    }
    LL res=Abs(A-B);
    FOR(i,0,min(c1,n)) if(n-i>=0 && n-i<=c2) {
        LL t=B+(LL)(n-i)*1000;
        res=min(res,Abs(A-t));
    }
    printf("%lld.%lld\n",res/1000,res%1000);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define TR(i,v)         for(__typeof((v).begin())i=(v).begin();i!=(v).end();++i)
#define DEBUG(x)        cout << #x << " = " << x << endl;
#define SIZE(p)         (int)(p).size()
#define MP(a, b)        make_pair((a), (b))
#define ALL(p)          (p).begin(), (p).end()
#define rep(i, n)       for(int (i)=0; (i)<(int)(n); ++(i))
#define REP(i, a, n)    for(int (i)=(a); (i)<(int)(n); ++(i))
#define FOR(i, a, b)    for(int (i)=(int)(a); (i)<=(int)(b); ++(i))
#define FORD(i, b, a)   for(int (i)=(int)(b); (i)>=(int)(a); --(i))
#define CLR(x, y)       memset((x), (y), sizeof((x)))
typedef long long LL;
typedef pair<int, int> pii;
inline LL Abs(LL x) {
    return x<0?-x:x;
}
int main(int argc, char const *argv[]) {
#ifndef ONLINE_JUDGE
    freopen("A.in", "r", stdin);
    // freopen("out", "w", stdout);
#endif
    // ios::sync_with_stdio(false);     cin.tie(0);
    LL A=0,B=0;
    int n;  scanf("%d",&n);
    int c1=0,c2=0;
    rep(i,n+n) {
        int a,b;    scanf("%d.%d",&a,&b);
        if(!b)  ++c1;
        else    ++c2;
        A+=a*1000+b,B+=a*1000;
    }
    LL res=Abs(A-B);
    FOR(i,0,min(c1,n)) if(n-i>=0 && n-i<=c2) {
        LL t=B+(LL)(n-i)*1000;
        res=min(res,Abs(A-t));
    }
    printf("%lld.%03lld\n",res/1000,res%1000);
    return 0;
}


// TwT514 {{{
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <bitset>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#define SZ(x) ((int)(x).size())
#define FOR(i,c) for (__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define REP(i,n) for (int i=0; i<(n); i++)
#define REP1(i,a,b) for (int i=(int)(a); i<=(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define MS0(x,n) memset((x),0,(n)*sizeof(*x))
#define MS1(x,n) memset((x),-1,(n)*sizeof(*x))
#define MP make_pair
#define PB push_back
#define RI(a) scanf("%d",&(a))
#define RII(a,b) scanf("%d%d",&(a),&(b))
#define RIII(a,b,c) scanf("%d%d%d",&(a),&(b),&(c))
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;
// }}}

#define N 4010
int n,a[N];
int main() {
    RI(n);
    REP(i,2*n) {
        double x;
        scanf("%lf",&x);
        a[i]=(int)(x*1000)%1000;
    }
    int s=0;
    REP(i,2*n) s+=a[i];
    int c=0;
    REP(i,2*n) if ( c<n && a[i]>0 && abs(s-1000)<abs(s) ) {
        c++;
        s-=1000;
    }
    printf("%.3f\n",abs(s)/1000.0);
    return 0;
}


// TwT514 {{{
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <bitset>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#define SZ(x) ((int)(x).size())
#define FOR(i,c) for (__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define REP(i,n) for (int i=0; i<(n); i++)
#define REP1(i,a,b) for (int i=(int)(a); i<=(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define MS0(x,n) memset((x),0,(n)*sizeof(*x))
#define MS1(x,n) memset((x),-1,(n)*sizeof(*x))
#define MP make_pair
#define PB push_back
#define RI(a) scanf("%d",&(a))
#define RII(a,b) scanf("%d%d",&(a),&(b))
#define RIII(a,b,c) scanf("%d%d%d",&(a),&(b),&(c))
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;
// }}}

#define N 4010
int n,a[N],b[N];
int main() {
    RI(n);
    REP(i,2*n) {
        double x;
        scanf("%lf",&x);
        a[i]=(int)(x*1000)%1000;
    }
    int s=0;
    REP(i,2*n) s+=a[i];
    if ( s>n*1000 ) s-=n*1000;
    else s=min(s%1000,1000-s%1000);
    printf("0.%d\n",s);
    return 0;
}


// TwT514 {{{
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <bitset>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#define SZ(x) ((int)(x).size())
#define FOR(i,c) for (__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define REP(i,n) for (int i=0; i<(n); i++)
#define REP1(i,a,b) for (int i=(int)(a); i<=(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define MS0(x,n) memset((x),0,(n)*sizeof(*x))
#define MS1(x,n) memset((x),-1,(n)*sizeof(*x))
#define MP make_pair
#define PB push_back
#define RI(a) scanf("%d",&(a))
#define RII(a,b) scanf("%d%d",&(a),&(b))
#define RIII(a,b,c) scanf("%d%d%d",&(a),&(b),&(c))
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;
// }}}

#define N 4010
int n,a[N],b[N];
int main() {
    RI(n);
    REP(i,2*n) {
        double x;
        scanf("%lf",&x);
        a[i]=(int)(x*1000)%1000;
    }
    int s=0;
    REP(i,2*n) s+=a[i];
    int ans=min(s%1000,1000-s%1000);
    printf("0.%d\n",ans);
    return 0;
}


// TwT514 {{{
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <bitset>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#define SZ(x) ((int)(x).size())
#define FOR(i,c) for (__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define REP(i,n) for (int i=0; i<(n); i++)
#define REP1(i,a,b) for (int i=(int)(a); i<=(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define MS0(x,n) memset((x),0,(n)*sizeof(*x))
#define MS1(x,n) memset((x),-1,(n)*sizeof(*x))
#define MP make_pair
#define PB push_back
#define RI(a) scanf("%d",&(a))
#define RII(a,b) scanf("%d%d",&(a),&(b))
#define RIII(a,b,c) scanf("%d%d%d",&(a),&(b),&(c))
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;
// }}}

#define N 4010
int n,a[N];
int main() {
    RI(n);
    REP(i,2*n) {
        double x;
        scanf("%lf",&x);
        a[i]=(int)(x*1000)%1000;
    }
    int s=0;
    REP(i,2*n) s+=a[i];
    int c=0;
    REP(i,2*n) if ( c<n && abs(s-1000)<abs(s) ) {
        c++;
        s-=1000;
    }
    printf("%.3f\n",s/1000.0);
    return 0;
}


// TwT514 {{{
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <bitset>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#define SZ(x) ((int)(x).size())
#define FOR(i,c) for (__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define REP(i,n) for (int i=0; i<(n); i++)
#define REP1(i,a,b) for (int i=(int)(a); i<=(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define MS0(x,n) memset((x),0,(n)*sizeof(*x))
#define MS1(x,n) memset((x),-1,(n)*sizeof(*x))
#define MP make_pair
#define PB push_back
#define RI(a) scanf("%d",&(a))
#define RII(a,b) scanf("%d%d",&(a),&(b))
#define RIII(a,b,c) scanf("%d%d%d",&(a),&(b),&(c))
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;
// }}}

#define N 4010
int n,a[N];
int main() {
    RI(n);
    REP(i,2*n) {
        double x;
        scanf("%lf",&x);
        a[i]=(int)(x*1000)%1000;
    }
    int s=0;
    REP(i,2*n) s+=a[i];
    int c=0;
    REP(i,2*n) if ( c<n && abs(s-1000)<abs(s) ) {
        c++;
        s-=1000;
    }
    printf("0.%d\n",s);
    return 0;
}


// TwT514 {{{
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <bitset>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#define SZ(x) ((int)(x).size())
#define FOR(i,c) for (__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define REP(i,n) for (int i=0; i<(n); i++)
#define REP1(i,a,b) for (int i=(int)(a); i<=(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define MS0(x,n) memset((x),0,(n)*sizeof(*x))
#define MS1(x,n) memset((x),-1,(n)*sizeof(*x))
#define MP make_pair
#define PB push_back
#define RI(a) scanf("%d",&(a))
#define RII(a,b) scanf("%d%d",&(a),&(b))
#define RIII(a,b,c) scanf("%d%d%d",&(a),&(b),&(c))
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;
// }}}

#define N 4010
int n,a[N];
int main() {
    RI(n);
    REP(i,2*n) {
        double x;
        scanf("%lf",&x);
        a[i]=(int)((x+1e-9)*1000)%1000;
    }
    int s=0;
    REP(i,2*n) s+=a[i];
    int c=0;
    REP(i,2*n) if ( c<n && a[i]>0 && abs(s-1000)<abs(s) ) {
        c++;
        s-=1000;
    }
    REP(i,2*n) if ( c<n && a[i]==0 ) {
        c++;
    }
    s-=(n-c)*1000;
    printf("%.3f\n",abs(s)/1000.0);
    return 0;
}


// TwT514 {{{
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <bitset>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#define SZ(x) ((int)(x).size())
#define FOR(i,c) for (__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define REP(i,n) for (int i=0; i<(n); i++)
#define REP1(i,a,b) for (int i=(int)(a); i<=(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define MS0(x,n) memset((x),0,(n)*sizeof(*x))
#define MS1(x,n) memset((x),-1,(n)*sizeof(*x))
#define MP make_pair
#define PB push_back
#define RI(a) scanf("%d",&(a))
#define RII(a,b) scanf("%d%d",&(a),&(b))
#define RIII(a,b,c) scanf("%d%d%d",&(a),&(b),&(c))
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;
// }}}

#define N 4010
int n,a[N];
int main() {
    RI(n);
    REP(i,2*n) {
        double x;
        scanf("%lf",&x);
        a[i]=(int)(x*1000)%1000;
    }
    int s=0;
    REP(i,2*n) s+=a[i];
    int c=0;
    REP(i,2*n) if ( c<n && abs(s-1000)<abs(s) ) {
        c++;
        s-=1000;
    }
    printf("%.3f\n",abs(s)/1000.0);
    return 0;
}


// TwT514 {{{
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <bitset>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#define SZ(x) ((int)(x).size())
#define FOR(i,c) for (__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define REP(i,n) for (int i=0; i<(n); i++)
#define REP1(i,a,b) for (int i=(int)(a); i<=(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define MS0(x,n) memset((x),0,(n)*sizeof(*x))
#define MS1(x,n) memset((x),-1,(n)*sizeof(*x))
#define MP make_pair
#define PB push_back
#define RI(a) scanf("%d",&(a))
#define RII(a,b) scanf("%d%d",&(a),&(b))
#define RIII(a,b,c) scanf("%d%d%d",&(a),&(b),&(c))
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;
// }}}

#define N 4010
int n,a[N];
int main() {
    RI(n);
    REP(i,2*n) {
        double x;
        scanf("%lf",&x);
        a[i]=(int)(x*1000)%1000;
    }
    int s=0;
    REP(i,2*n) s+=a[i];
    int c=0;
    REP(i,2*n) if ( c<n && a[i]>0 && abs(s-1000)<abs(s) ) {
        c++;
        s-=1000;
    }
    REP(i,2*n) if ( c<n && a[i]==0 ) {
        c++;
    }
    s-=(n-c)*1000;
    printf("%.3f\n",abs(s)/1000.0);
    return 0;
}


//#define PROB ""        //{{{ Preamble
#define IN   PROB ".in"  // "input.txt"
#define OUT  PROB ".out" // "output.txt"
#ifndef LOCAL_PC
#define NDEBUG
#define LOG(...) static_cast<void>(0)
#else
#include <local>
#endif
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
#include <forward_list>
#include <future>
#include <regex>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std; typedef long long ll; typedef unsigned long long ull;
const double pi=3.14159265358979323846; const double E=2.7182818284590452354;
const struct _ { ios_base::Init i; _(){ srand(time(NULL));
    ios_base::sync_with_stdio(false); cin.tie(NULL); } } _;
#if defined(PROB) && !defined(LOCAL_PC)
const struct $ { filebuf a,b; ~$(){ cin.rdbuf(NULL); cout.rdbuf(NULL); }
    $(){ cin.rdbuf(a.open(IN,ios::in)); cout.rdbuf(b.open(OUT,ios::out)); } }$;
#endif
template<class I> inline void in(I A, I B) { while (A!=B) { cin >> *A; ++A; } }
template<class I> inline void out(I A, I B, char D=' ') { if (A!=B) {
    cout << *A; while (++A!=B) { cout << D << *A; } } cout << '\n'; }
template<class T> inline T sq(const T& X) { return X*X; }
template<class T> inline T power(T X, int Y) { assert(Y>=0 && !(X==0 && Y==0));
    T R=(Y&1)?X:1; while (Y >>= 1) { X *= X; if (Y&1) R *= X; } return R; }
#define endl         '\n'
#define pb(...)      push_back(__VA_ARGS__)
#define eb(...)      emplace_back(__VA_ARGS__)
#define sz(v)        static_cast<int>((v).size())
#define X            first
#define Y            second
#define FOREACH(i,c) for(__typeof__((c).begin())i=(c).begin();i!=(c).end();++i)
#define mp(x, y)     make_pair((x), (y))
#define mt(...)      make_tuple(__VA_ARGS__)
#define ass(e)       assert(e)
//}}}//////////////////////////////////////////////////////////////////////////

int arr[2005];

int main()
{
    int n; cin >> n; n *= 2;

    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
        cin.ignore();
        cin >> arr[i];
    }

    sort(arr, arr+n);

    int z = 0;
    while (z < n && !arr[z])
        z++;

    ll sum = accumulate(arr, arr+n, 0LL);

    ll res = LLONG_MAX;

    for (int q = max(0, n/2-z); q <= min(n/2, n-z); q++)
    {
        if (abs(sum - q*1000) < abs(res))
        {
            res = sum - q*1000;
        }
    }

    cout << res/1000 << "." << setw(3) << setfill('0') << res%1000 << endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define T() long long t;cin>>t;for(long long i=1;i<=t;i++)
#define INF (int)MAX_INT
#define INFS (int)MIN_INT
#define mod 1000000007
#define FOR(a, b, n) for(int a = b; a < n; a++)
#define REP(a,c, b) for(int a = c; a < b; a++)
#define FORD(a, b, c) for(int a = b; a >= c; a--)
#define REPD(a, c,b) for(int a = b-1; a >= c; a--)
#ifdef HOHOHO
#define DEBUG(x) cerr << #x << " : " << x << '\n'
#define DEBUGV(x) cerr << #x << " : { "; REP(_it, x.size()) cerr << x[_it] << ' '; cerr << "}" << '\n'
#define DEBUGA(x, y) cerr << #x << " : { "; REP(_it, y) cerr << x[_it] << ' '; cerr << "}" << '\n'
#define PRINTF(...) fprintf(stderr,__VA_ARGS__)
#define CHECKPOINT cerr << "OK LINE #" << __LINE__ << '\n'
#else
#define DEBUG(x) {}
#define DEBUGV(x) {}
#define DEBUGA(x, y) {}
#define PRINTF(...) {}
#define CHECKPOINT {}
#endif
#define RESET(a, b) memset(a, b, sizeof a)
#define EPS 1e-9
#define m_p make_pair
#define pb push_back
#define fi first
#define se second
#define RALL(x) x.rbegin(), x.rend()
#define all(x) x.begin(), x.end()
#define ALL(x, y) x, x+y
#define SZ(x) ((int)x.size())
#define  pi(a)  pair<a, a>
#define  vi(a)  vector<a>
#define  vii vector<pi>
#define  vs vector<string>
template<class T> T sqr(T x){ return x*x; }
template<class T> T binPow(T p, int q, int MOD) {
    if(q == 1) return p % MOD;
    if(q & 1) return p*(binPow(p, q-1, MOD) % MOD) % MOD;
    else return sqr(binPow(p, q/2, MOD) % MOD) % MOD;
}

ll nxt() {
    ll TemporaryVariable;
    cin >> TemporaryVariable;
    return TemporaryVariable;
}
const double PI = acos(-1.0);
#define MAXN 100001
const int N = 2e5 + 5;

int main(){
  ios::sync_with_stdio(false);

    ll a=nxt(),b=nxt(),z=nxt();
    ll cnt=0,pes1=0,pes2=0;

    cnt+=a/z;
    if(a%z!=0){
        pes1=a%z;
    }

    cnt+=b/z;
    if(b%z!=0){
      pes2=b%z;
    }
      ll q=pes2+pes1;
    ll MAx=0;
     if(a%z!=0&&b%z!=0){
    MAx=max(pes1,pes2);
    MAx=z%MAx;
     }
     else{
     MAx=0;
     }

    cnt+=q/z;
    cout<<cnt<<" "<<MAx<<endl;

    #ifdef HOHOHO
    fprintf(stderr, "%.3lf\n", clock() / (double) CLOCKS_PER_SEC );
#endif
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int l,b,p,z,s,t;
	cin>>l>>b>>p;
	s=l%p;
	t=b%p;
	if(s<t)
	{
		l=l-t;
		b=b+t;
		z= (l/p)+(b/p);
		cout<<z<<" "<<s;
	}
	if(s>t)
	{
		b=b-t;
		l=l+t;
		z=(l/p)+(b/p);
		cout<<z<<" "<<t;
	}
	if(s==t)
	{
		z=(l/p)+(b/p);
		cout<<z<<" "<<t;
	}
	return 0;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	unsigned long long int l,b,p,z,s,t,k,m,x;
	cin>>l>>b>>p;
	k=l%p;
	m=b%p;
//	x=min((p-k),(p-m));
	x=p-max(k,m);
	if(k<m)
	{
		l=l-x;
		b=b+x;
		z= (l/p)+(b/p);
		if((k+m)>=p)
		cout<<z<<" "<<x;
		else
		cout<<z<<" "<<'0';
	}
	if(k>m)
	{
		b=b-x;
		l=l+x;
		z=(l/p)+(b/p);
		if((k+m)>=p)
		cout<<z<<" "<<x;
		else
		cout<<z<<" "<<'0';
	}
	if(k==m)
	{
		z=(l/p)+(b/p);
		if((k+m)>=p)
		cout<<(z+1)<<" "<<x;
		else
		cout<<z<<" "<<'0';
	}
	return 0;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	unsigned long long int l,b,p,s,t,x;
	int z,k,m;
	cin>>l>>b>>p;
	k=l%p;
	m=b%p;
//	x=min((p-k),(p-m));
	x=p-max(k,m);

	if(l<p || b<p)
	{
		cout<<'0'<<" "<<'0';
	}
	else if(k<m)
	{
		l=l-x;
		b=b+x;
		z= (l/p)+(b/p);
		if((k+m)>=p)
		cout<<z<<" "<<x;
		else
		cout<<z<<" "<<'0';
	}
	else if(k>m)
	{
		b=b-x;
		l=l+x;
		z=(l/p)+(b/p);
		if((k+m)>=p)
		cout<<z<<" "<<x;
		else
		cout<<z<<" "<<'0';
	}
	else if(k==m)
	{
		z=(l/p)+(b/p);
		if((k+m)>=p)
		cout<<(z+1)<<" "<<x;
		else
		cout<<z<<" "<<'0';
	}

	return 0;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	unsigned long long int l,b,p,s,t,x;
	int z,k,m;
	cin>>l>>b>>p;
	k=l%p;
	m=b%p;
//	x=min((p-k),(p-m));
	x=p-max(k,m);

	if(l<p && b<p)
	{
		cout<<'0'<<" "<<'0';
	}
	else if(k<m)
	{
		l=l-x;
		b=b+x;
		z= (l/p)+(b/p);
		if((k+m)>=p)
		cout<<z<<" "<<x;
		else
		cout<<z<<" "<<'0';
	}
	else if(k>m)
	{
		b=b-x;
		l=l+x;
		z=(l/p)+(b/p);
		if((k+m)>=p)
		cout<<z<<" "<<x;
		else
		cout<<z<<" "<<'0';
	}
	else if(k==m)
	{
		z=(l/p)+(b/p);
		if((k+m)>=p)
		cout<<(z+1)<<" "<<x;
		else
		cout<<z<<" "<<'0';
	}

	return 0;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int l,b,p,z,s,t,k,m,x;
	cin>>l>>b>>p;
	k=l%p;
	m=b%p;
	x=min((p-k),(p-m));

	if(k<m)
	{
		l=l-x;
		b=b+x;
		z= (l/p)+(b/p);
		cout<<z<<" "<<x;
	}
	if(k>m)
	{
		b=b-x;
		l=l+x;
		z=(l/p)+(b/p);
		cout<<z<<" "<<x;
	}
	if(k==m)
	{
		z=(l/p)+(b/p);
		cout<<z<<" "<<k;
	}
	return 0;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	unsigned long long int l,b,p,z,s,t,k,m,x;
	cin>>l>>b>>p;
	k=l%p;
	m=b%p;
//	x=min((p-k),(p-m));
	x=p-max(k,m);
	if(k<m)
	{
		l=l-x;
		b=b+x;
		z= (l/p)+(b/p);
		if((k+m)>=p)
		cout<<z<<" "<<x;
		else
		cout<<z<<" "<<'0';
	}
	if(k>m)
	{
		b=b-x;
		l=l+x;
		z=(l/p)+(b/p);
		if((k+m)>=p)
		cout<<z<<" "<<x;
		else
		cout<<z<<" "<<'0';
	}
	if(k==m)
	{
		z=(l/p)+(b/p);
		if((k+m)>=p)
		cout<<z<<" "<<x;
		else
		cout<<z<<" "<<'0';
	}
	return 0;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	unsigned long long int l,b,p,z,s,t,k,m,x;
	cin>>l>>b>>p;
	k=l%p;
	m=b%p;
//	x=min((p-k),(p-m));
	x=p-max(k,m);
	if(k<m)
	{
		l=l-x;
		b=b+x;
		z= (l/p)+(b/p);
		if((k+m)>=p)
		cout<<z<<" "<<x;
		else
		cout<<z<<" "<<'0';
	}
	if(k>m)
	{
		b=b-x;
		l=l+x;
		z=(l/p)+(b/p);
		if((k+m)>=p)
		cout<<z<<" "<<x;
		else
		cout<<z<<" "<<'0';
	}
	if(k==m)
	{
		z=(l/p)+(b/p);
		cout<<z<<" "<<'0';
	}
	return 0;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int l,b,p,z,s,t,k,m,x;
	cin>>l>>b>>p;
	k=l%p;
	m=b%p;
	x=min((p-k),(p-m));

	if(k<m)
	{
		l=l-x;
		b=b+x;
		z= (l/p)+(b/p);
		cout<<z<<" "<<x;
	}
	if(k>m)
	{
		b=b-x;
		l=l+x;
		z=(l/p)+(b/p);
		cout<<z<<" "<<x;
	}
	if(k==m)
	{
		z=(l/p)+(b/p);
		cout<<z<<" "<<x;
	}
	return 0;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int l,b,p,z,s,t;
	cin>>l>>b>>p;
	s=l%p;
	t=b%p;
	if(s<t)
	{
		l=l-t;
		b=b+t;
		z= (l/p)+(b/p);
		cout<<z<<" "<<t;
	}
	if(s>t)
	{
		b=b-t;
		l=l+t;
		z=(l/p)+(b/p);
		cout<<z<<" "<<t;
	}
	if(s==t)
	{
		z=(l/p)+(b/p);
		cout<<z<<" "<<t;
	}
	return 0;

}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ll x, y, z;
    cin>>x>>y>>z;
    ll sum = 0;
    if(x%z==0 && y%z==0){
        cout<<(x/z) + (y/z)<<" "<<0;
        return 0;
    }
    if(x%z>y%z){
        cout<<(x+y%z)/z + (y-y%z)/z<<" ";
        ll ans = (x+(y%z))/z;
        ans = ans*z - x;
        cout<<ans;
    }
    else {
        cout<<(y+x%z)/z + (x-x%z)/z<<" ";
        ll ans = (y+x%z)/z;
        ans = ans*z - y;
        cout<<ans;
    }
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ll x, y, z;
    cin>>x>>y>>z;
    ll sum = 0;
    if(x%z==0 && y%z==0){
        cout<<(x/z) + (y/z)<<" "<<0;
        return 0;
    }
    if(x%z>y%z){
        cout<<(x+y%z)/z + (y-y%z)/z<<" "<<y%z;
    }
    else cout<<(y+x%z)/z + (x-x%z)/z<<" "<<x%z;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ll x, y, z;
    cin>>x>>y>>z;
    ll sum = 0;
    if(x%z==0 && y%z==0){
        cout<<(x/z) + (y/z)<<" "<<0;
        return 0;
    }
    if(x%z>y%z){
        cout<<(x+y%z)/z + (y-y%z)/z<<" ";
        ll ans = (x+(y%z))/z;
        ans = ans*z - x;
        if(ans<0)
        cout<<0;
        else cout<<ans;
    }
    else {
        cout<<(y+x%z)/z + (x-x%z)/z<<" ";
        ll ans = (y+x%z)/z;
        ans = ans*z - y;
        if(ans<0)
        cout<<0;
        else cout<<ans;
    }
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ll x, y, z;
    cin>>x>>y>>z;
    ll sum = 0;
    if(x%z==0 && y%z==0){
        cout<<(x/z) + (y/z)<<" "<<0;
        return 0;
    }
    if(x%z>y%z){
        cout<<(x+y%z)/z + (y-y%z)/z<<" "<<(y-y%z)/z;
    }
    else cout<<(y+x%z)/z + (x-x%z)/z<<" "<<(x-x%z)/z;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ll x, y, z;
    cin>>x>>y>>z;
    ll sum = 0;
    if(x%z==0 && y%z==0){
        cout<<(x/z) + (y/z)<<" "<<0;
        return 0;
    }
    if(x%z>y%z){
        cout<<(x+y%z)/z + (y-y%z)/z<<" ";
        ll ans = (x+(y%z))/z;
        ans = ans*z - x;
        if(ans<0)
        cout<<0;
        else cout<<ans;
        cout<<ans;
    }
    else {
        cout<<(y+x%z)/z + (x-x%z)/z<<" ";
        ll ans = (y+x%z)/z;
        ans = ans*z - y;
        if(ans<0)
        cout<<0;
        else cout<<ans;
    }
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ll x, y, z;
    cin>>x>>y>>z;
    ll sum = 0;
    if(x%z==0 && y%z==0){
        cout<<(x/z) + (y/z)<<" "<<0;
        return 0;
    }
    if(x%z!=0 && y%z!=0){
       cout<<(x%z) + (y%z)<<" ";
       if(x%z>y%z){
            cout<<y%z;
        }
        else cout<<x%z;
       return 0;
    }
    if(x%z!=0) cout<<(x%z) + (y/z)<<" "<<0;
    if(y%z!=0) cout<<(y%z) + (x/z)<<" "<<0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ll x, y, z;
    cin>>x>>y>>z;
    ll sum = 0;
    if(x%z>y%z){
        cout<<(x+y%z)/z + (y-y%z)/z<<" ";
        ll ans = (x+y%z)/z;
        ans = ans*z - x;
        if(ans<0)
        cout<<0;
        else cout<<ans;
    }
    else {
        cout<<(y+x%z)/z + (x-x%z)/z<<" ";
        ll ans = (y+x%z)/z;
        ans = ans*z - y;
        if(ans<0)
        cout<<0;
        else cout<<ans;
    }
}


#include <bits/stdc++.h>
#include<list>
#include<algorithm>
#define ll long long int
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define rep for(i=0;i<n;i++)
#define repr for(i=n-1;i>=0;i--)
#define pii pair<ll,ll>
#define pll pair<ll, ll>
#define l length()
#define inf 100000001
#define mod 1000000007
#define lb lower_bound
#define up upper_bound
#define rep1 for(i=1;i<n;i++)
#define vr vector
#define ef else if
#define SORT(A) sort(A.begin(), A.end());
#define REVERSE(A) reverse(A.begin(), A.end());
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;
/*	input string with spaces
std::string str;
std::getline(std::cin >> std::ws, str);
*/
ll myXOR(ll x, ll y)
{
   return (x | y) & (~x | ~y);
}
ll powerLL(ll x, ll n)
{
    ll result = 1;
    while (n) {
        if (n & 1)
            result = result * x % mod;
        n = n / 2;
        x = x * x % mod;
    }
    return result;
}
int main()
{
	fastio
	ll x,y,z;
	cin>>x>>y>>z;
	ll cnt=0;
	cout<<(x+y)/z<<" "<<min(x%z, y%z);
	// ll x1,y1;
	// cnt+=x/z;
	// x1  =x%z;
	// cnt+=y/z;
	// y1  =y%z;
	// ll addz = (x1+y1)/z;
	// ll mini;
	// if(addz==0)
	// {
	// 	mini=0;
	// }
	// else
	// {
	// 	mini = min(x1,y1);
	// 	cnt = cnt + addz;
	// }
	// cout<<cnt<<" "<<mini<<"\n";
	// return 0;
}


#include <bits/stdc++.h>
#include<list>
#include<algorithm>
#define ll long long int
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define rep for(i=0;i<n;i++)
#define repr for(i=n-1;i>=0;i--)
#define pii pair<ll,ll>
#define pll pair<ll, ll>
#define l length()
#define inf 100000001
#define mod 1000000007
#define lb lower_bound
#define up upper_bound
#define rep1 for(i=1;i<n;i++)
#define vr vector
#define ef else if
#define SORT(A) sort(A.begin(), A.end());
#define REVERSE(A) reverse(A.begin(), A.end());
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;
/*	input string with spaces
std::string str;
std::getline(std::cin >> std::ws, str);
*/
ll myXOR(ll x, ll y)
{
   return (x | y) & (~x | ~y);
}
ll powerLL(ll x, ll n)
{
    ll result = 1;
    while (n) {
        if (n & 1)
            result = result * x % mod;
        n = n / 2;
        x = x * x % mod;
    }
    return result;
}
int main()
{
	fastio
	ll x,y,z;
	cin>>x>>y>>z;
	ll cnt=0;
	ll xu = x/z;
	ll xl = x%z;
	ll yu = y/z;
	ll yl = y%z;
	cnt = cnt + xu + yu + (xl+yl)/z;
	ll ans=0;
	if(xl+yl>=z)
	{
		ll mini = min(xl,yl);
		ll maxi = max(xl,yl);
		ans = z-maxi;
	}
	cout<<cnt<<" "<<ans;

}


#include <bits/stdc++.h>
#include<list>
#include<algorithm>
#define ll long long int
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define rep for(i=0;i<n;i++)
#define repr for(i=n-1;i>=0;i--)
#define pii pair<ll,ll>
#define pll pair<ll, ll>
#define l length()
#define inf 100000001
#define mod 1000000007
#define lb lower_bound
#define up upper_bound
#define rep1 for(i=1;i<n;i++)
#define vr vector
#define ef else if
#define SORT(A) sort(A.begin(), A.end());
#define REVERSE(A) reverse(A.begin(), A.end());
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;
/*	input string with spaces
std::string str;
std::getline(std::cin >> std::ws, str);
*/
ll myXOR(ll x, ll y)
{
   return (x | y) & (~x | ~y);
}
ll powerLL(ll x, ll n)
{
    ll result = 1;
    while (n) {
        if (n & 1)
            result = result * x % mod;
        n = n / 2;
        x = x * x % mod;
    }
    return result;
}
int main()
{
	// fastio
	ll x,y,z;
	cin>>x>>y>>z;
	ll cnt=0;
	ll x1,y1;
		cnt+=x/z;
		x1  =x%z;
		cnt+=y/z;
		y1  =y%z;
	ll mini;
	if(x1<y1)
		mini=x1;
	else
		mini=y1;
	cout<<cnt+mini<<" "<<mini<<"\n";
	return 0;
}


#include <bits/stdc++.h>
#include<list>
#include<algorithm>
#define ll long long int
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define rep for(i=0;i<n;i++)
#define repr for(i=n-1;i>=0;i--)
#define pii pair<ll,ll>
#define pll pair<ll, ll>
#define l length()
#define inf 100000001
#define mod 1000000007
#define lb lower_bound
#define up upper_bound
#define rep1 for(i=1;i<n;i++)
#define vr vector
#define ef else if
#define SORT(A) sort(A.begin(), A.end());
#define REVERSE(A) reverse(A.begin(), A.end());
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;
/*	input string with spaces
std::string str;
std::getline(std::cin >> std::ws, str);
*/
ll myXOR(ll x, ll y)
{
   return (x | y) & (~x | ~y);
}
ll powerLL(ll x, ll n)
{
    ll result = 1;
    while (n) {
        if (n & 1)
            result = result * x % mod;
        n = n / 2;
        x = x * x % mod;
    }
    return result;
}
int main()
{
	// fastio
	ll x,y,z;
	cin>>x>>y>>z;
	ll cnt=0;
	ll x1,y1;
	if(x>z)
	{
		cnt+=x/z;
		x1  =x%z;
	}
	if(y>z)
	{
		cnt+=y/z;
		y1  =y%z;
	}
	ll mini;
	if(x1<y1)
		mini=x1;
	else
		mini=y1;
	cout<<cnt+mini<<" "<<mini<<"\n";
	return 0;
}


#include <bits/stdc++.h>
#include<list>
#include<algorithm>
#define ll long long int
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define rep for(i=0;i<n;i++)
#define repr for(i=n-1;i>=0;i--)
#define pii pair<ll,ll>
#define pll pair<ll, ll>
#define l length()
#define inf 100000001
#define mod 1000000007
#define lb lower_bound
#define up upper_bound
#define rep1 for(i=1;i<n;i++)
#define vr vector
#define ef else if
#define SORT(A) sort(A.begin(), A.end());
#define REVERSE(A) reverse(A.begin(), A.end());
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;
/*	input string with spaces
std::string str;
std::getline(std::cin >> std::ws, str);
*/
ll myXOR(ll x, ll y)
{
   return (x | y) & (~x | ~y);
}
ll powerLL(ll x, ll n)
{
    ll result = 1;
    while (n) {
        if (n & 1)
            result = result * x % mod;
        n = n / 2;
        x = x * x % mod;
    }
    return result;
}
int main()
{
	// fastio
	ll x,y,z;
	cin>>x>>y>>z;
	ll cnt=0;
	ll x1,y1;
	cnt+=x/z;
	x1  =x%z;
	cnt+=y/z;
	y1  =y%z;

	ll mini=0;
	if(x1+y1==z)
		mini=min(x1,y1);
	cout<<cnt+mini<<" "<<mini<<"\n";
	return 0;
}


#include <bits/stdc++.h>
#include<list>
#include<algorithm>
#define ll long long int
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define rep for(i=0;i<n;i++)
#define repr for(i=n-1;i>=0;i--)
#define pii pair<ll,ll>
#define pll pair<ll, ll>
#define l length()
#define inf 100000001
#define mod 1000000007
#define lb lower_bound
#define up upper_bound
#define rep1 for(i=1;i<n;i++)
#define vr vector
#define ef else if
#define SORT(A) sort(A.begin(), A.end());
#define REVERSE(A) reverse(A.begin(), A.end());
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;
/*	input string with spaces
std::string str;
std::getline(std::cin >> std::ws, str);
*/
ll myXOR(ll x, ll y)
{
   return (x | y) & (~x | ~y);
}
ll powerLL(ll x, ll n)
{
    ll result = 1;
    while (n) {
        if (n & 1)
            result = result * x % mod;
        n = n / 2;
        x = x * x % mod;
    }
    return result;
}
int main()
{
	fastio
	ll x,y,z;
	cin>>x>>y>>z;
	ll cnt=0;
	ll xu = x/z;
	ll xl = x%z;
	ll yu = y/z;
	ll yl = y%z;
	cnt = cnt + xu + yu + (xl+yl)/z;
	ll xyl = (xl+yl)%z;
	ll mini = min(xl,yl)-xyl;
	cout<<cnt<<" "<<mini;

}


#include <bits/stdc++.h>
#include<list>
#include<algorithm>
#define ll long long int
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define rep for(i=0;i<n;i++)
#define repr for(i=n-1;i>=0;i--)
#define pii pair<ll,ll>
#define pll pair<ll, ll>
#define l length()
#define inf 100000001
#define mod 1000000007
#define lb lower_bound
#define up upper_bound
#define rep1 for(i=1;i<n;i++)
#define vr vector
#define ef else if
#define SORT(A) sort(A.begin(), A.end());
#define REVERSE(A) reverse(A.begin(), A.end());
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;
/*	input string with spaces
std::string str;
std::getline(std::cin >> std::ws, str);
*/
ll myXOR(ll x, ll y)
{
   return (x | y) & (~x | ~y);
}
ll powerLL(ll x, ll n)
{
    ll result = 1;
    while (n) {
        if (n & 1)
            result = result * x % mod;
        n = n / 2;
        x = x * x % mod;
    }
    return result;
}
int main()
{
	fastio
	ll x,y,z;
	cin>>x>>y>>z;
	ll cnt=0;
	ll x1,y1;
	cnt+=x/z;
	x1  =x%z;
	cnt+=y/z;
	y1  =y%z;
	ll addz = (x1+y1)/z;
	ll mini;
	if(addz==0)
	{
		mini=0;
	}
	else
	{
		mini = min(x1,y1);
		cnt = cnt + addz;
	}
	cout<<cnt<<" "<<mini<<"\n";
	return 0;
}


#include <bits/stdc++.h>
#include<list>
#include<algorithm>
#define ll long long int
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define rep for(i=0;i<n;i++)
#define repr for(i=n-1;i>=0;i--)
#define pii pair<ll,ll>
#define pll pair<ll, ll>
#define l length()
#define inf 100000001
#define mod 1000000007
#define lb lower_bound
#define up upper_bound
#define rep1 for(i=1;i<n;i++)
#define vr vector
#define ef else if
#define SORT(A) sort(A.begin(), A.end());
#define REVERSE(A) reverse(A.begin(), A.end());
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;
/*	input string with spaces
std::string str;
std::getline(std::cin >> std::ws, str);
*/
ll myXOR(ll x, ll y)
{
   return (x | y) & (~x | ~y);
}
ll powerLL(ll x, ll n)
{
    ll result = 1;
    while (n) {
        if (n & 1)
            result = result * x % mod;
        n = n / 2;
        x = x * x % mod;
    }
    return result;
}
int main()
{
	fastio
	ll x,y,z;
	cin>>x>>y>>z;
	ll cnt=0;
	ll xu = x/z;
	ll xl = x%z;
	ll yu = y/z;
	ll yl = y%z;
	cnt = cnt + xu + yu + (xl+yl)/z;
	ll xyl = (xl+yl)%z;
	ll mini = min(x1,yl)-xyl;
	cout<<cnt<<" "<<mini;

}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int judge(ll a,ll b){
	return a<b?a:b;
}

int main(){

	ll x,y,z;
	cin>>x>>y>>z;

	ll t=x+y;

	ll max=t/z;

	ll c=0;
	if(x%z+y%z>=z){
		c=judge(z-x%z,z-y%z);
	}
//	if((x%z!=0)&&(y%z!=0)){
//		if((x/z+y/z)<max)
//			c=judge(z-x%z,z-y%z);
//	}

	cout<<max<<" "<<c;

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

ll judge(ll a,ll b){
	return a<b?a:b;
}

int main(){

	ll x,y,z;
	cin>>x>>y>>z;

	ll t=x+y;

	ll max=t/z;

	ll c=0;
	if((x%z!=0)&&(y%z!=0)){
		if((x/z+y/z)<max)
			c=judge(z-x%z,z-y%z);
	}

	cout<<max<<" "<<c;

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

ll judge(ll a,ll b){
	return a<b?a:b;
}

int main(){

	ll x,y,z;
	cin>>x>>y>>z;

	ll max=x/z+y/z;

	ll c=0;
	if(x%z+y%z>=z){
		c=judge(z-x%z,z-y%z);
		max++;
	}

//	if((x%z!=0)&&(y%z!=0)){
//		if((x/z+y/z)<max)
//			c=judge(z-x%z,z-y%z);
//	}

	cout<<max<<" "<<c<<endl;

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int judge(ll a,ll b){
	return a<b?a:b;
}

int main(){

	ll x,y,z;
	cin>>x>>y>>z;

	ll t=x+y;

	ll max=t/z;

	ll c=0;
	if((x%z!=0)&&(y%z!=0)){
		if((x/z+y/z)<max)
			c=judge(z-x%z,z-y%z);
	}

	cout<<max<<" "<<c;

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int judge(ll a,ll b){
	return a<b?a:b;
}

int main(){

	ll x,y,z;
	cin>>x>>y>>z;

	ll max=x/z+y/z;

	ll c=0;
	if(x%z+y%z>=z){
		c=judge(z-x%z,z-y%z);
		max++;
	}

//	if((x%z!=0)&&(y%z!=0)){
//		if((x/z+y/z)<max)
//			c=judge(z-x%z,z-y%z);
//	}

	cout<<max<<" "<<c<<endl;

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int judge(ll a,ll b){
	return a<b?a:b;
}

int main(){

	ll x,y,z;
	cin>>x>>y>>z;

	ll t=x+y;

	ll max=t/z;

	ll c=0;
	if((x%z!=0)&&(y%z!=0)){
		c=judge(z-x%z,z-y%z);
	}

	cout<<max<<" "<<c;

	return 0;
}


#include <cstdio>
#include<math.h>
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
int main()
{
    ll x,y,z;
    cin>>x>>y>>z;
    ll sum=0,s,x1,y1;
    sum=x/z+y/z;
    x1=x%z;y1=y%z;
    if(x1+y1<z)
    {
        cout<<sum<<" 0"<<'\n';
    }
    else
    {
        if(x1>y1)
        {
            s=z-x1;
        }
        else s=z-y1;
        sum++;
        cout<<sum<<" "<<s<<'\n';
    }
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int judge(ll a,ll b){
	return a<b?a:b;
}

int main(){

	ll x,y,z;
	cin>>x>>y>>z;

	ll max=x/z+y/z;

	ll c=0;
	if(x%z+y%z>=z){
		c=judge(z-x%z,z-y%z);
		max++;
	}

//	if((x%z!=0)&&(y%z!=0)){
//		if((x/z+y/z)<max)
//			c=judge(z-x%z,z-y%z);
//	}

	cout<<max<<" "<<c;

	return 0;
}


#include<iostream>
using namespace std;
int main()
{
    unsigned long long x,y,z,c,g;
    cin>>x>>y>>z;
    if(x%z==0&&y%z==0)
    cout<<(x/z)+(y/z)<<" "<<0;
    else
    {
        if((x%z)>=(y%z))
        {
            c=x+(y%z);
            g=y-(y%z);
            cout<<(c/z)+(g/z)<<" "<<min(z-x%z,z-y%z);
        }
        else
        {
            c=y+(x%z);
            g=x-(x%z);
            cout<<(c/z)+(g/z)<<" "<<c-y<<min(z-x%z,z-y%z);
        }
    }
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    ll x,y,z,give=0;
    cin>>x>>y>>z;
    ll coconut=x/z+y/z;
    x%=z;
    y%=z;
    if(x+y>=z)
    {
        coconut++;
        give=min(z-x,z-y);
    }
    cout<<coconut<<" "<<give;
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    unsigned long long x,y,z,give=0;
    cin>>x>>y>>z;
    unsigned long long coconut=x/z+y/z;
    x%=z;
    y%=z;
    if(x+y>=z)
    {
        coconut++;
        give=min(z-x,z-y);
    }
    cout<<coconut<<" "<<give;
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    unsigned long int x,y,z,c,g;
    cin>>x>>y>>z;
    if(x%z==0&&y%z==0)
    cout<<(x/z)+(y/z)<<" "<<0;
    else
    {
        if((x%z)>=(y%z))
        {
            x=x+(y%z);
            y=y-(y%z);
            cout<<(x/z)+(y/z)<<" "<<y%z;
        }
        else
        {
            y=y+(x%z);
            x=x-(x%z);
            cout<<(x/z)+(y/z)<<" "<<x%z;
        }
    }
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    unsigned long int x,y,z,c,g;
    if(x%z==0&&y%z==0)
    cout<<(x/z)+(y/z)<<" "<<0;
    else
    {
        if((x%z)>=(y%z))
        {
            x=x+(y%z);
            y=y-(y%z);
            cout<<(x/z)+(y/z)<<" "<<y%z;
        }
        else
        {
            y=y+(x%z);
            x=x-(x%z);
            cout<<(x/z)+(y/z)<<" "<<x%z;
        }
    }
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    unsigned long long x,y,z,c,g;
    cin>>x>>y>>z;
    if(x%z==0&&y%z==0)
    cout<<(x/z)+(y/z)<<" "<<0;
    else
    {
        if((x%z)>=(y%z))
        {
            c=x+(y%z);
            g=y-(y%z);
            cout<<(c/z)+(g/z)<<" "<<c-x;
        }
        else
        {
            c=y+(x%z);
            g=x-(x%z);
            cout<<(c/z)+(g/z)<<" "<<c-y;
        }
    }
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    unsigned long long x,y,z,c,g,give,a,b;
    cin>>x>>y>>z;
    a=x%z; b=y%z;
    if(a==0&&b==0)
    cout<<(x/z)+(y/z)<<" "<<0;
    else
    {   give=min(z-a,z-b);
        if(a>=b)
        {
            c=x+b;
            g=y-b;
            cout<<(c/z)+(g/z)<<" ";
            if(a==0||b==0)
            cout<<0;
            else
            cout<<give;
        }
        else
        {
            c=y+(x%z);
            g=x-(x%z);
            cout<<(c/z)+(g/z)<<" ";
            if(a==0||b==0)
            cout<<0;
            else
            cout<<give;
        }
    }
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    unsigned long long x,y,z,c,g;
    cin>>x>>y>>z;
    if(x%z==0&&y%z==0)
    cout<<(x/z)+(y/z)<<" "<<0;
    else
    {
        if((x%z)>=(y%z))
        {
            c=x+(y%z);
            g=y-(y%z);
            cout<<(c/z)+(g/z)<<" "<<min(z-x%z,z-y%z);
        }
        else
        {
            c=y+(x%z);
            g=x-(x%z);
            cout<<(c/z)+(g/z)<<" "<<min(z-x%z,z-y%z);
        }
    }
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    unsigned long int x,y,z,c,g;
    cin>>x>>y>>z;
    if(x%z==0&&y%z==0)
    cout<<(x/z)+(y/z)<<" "<<0;
    else
    {
        if((x%z)>=(y%z))
        {
            c=x+(y%z);
            g=y-(y%z);
            cout<<(c/z)+(g/z)<<" "<<c-x;
        }
        else
        {
            c=y+(x%z);
            g=x-(x%z);
            cout<<(c/z)+(g/z)<<" "<<c-y;
        }
    }
    return 0;
}


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

typedef long long int ll;

int main() {

	ll x, y, z;

	cin >> x >> y >> z;
	if (x < y) swap(x, y);
	if (x + y >= z) {
		if (x % z == 0 or y % z == 0)
			cout << (x + y) / z << " 0\n";
		else {
			if (x / z == (x + y) / z)
				cout << (x + y) / z << " 0\n";
			else
				cout << (x + y) / z << " " << min(z - (x % z), z - (y % z)) << "\n";
		}
	}
	else {
		cout << "0 0\n";
	}
	return 0;
}


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

typedef long long int ll;

int main() {

	ll x, y, z;

	cin >> x >> y >> z;
	if (x % z == 0 or y % z == 0)
		cout << (x + y) / z << " 0\n";
	else
		cout << (x + y) / z << " " << min(z - (x % z), z - (y % z)) << "\n";
	return 0;
}


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

typedef long long int ll;

int main() {

	ll x, y, z, total;

	cin >> x >> y >> z;
	total = (x + y) / z;
	if (x < y) swap(x, y);
	if (x + y >= z) {
		if (x / z == (x + y) / z)
			cout << x / z << " 0\n";
		else {
			int cnt = 0;
			ll _x = x, _y = y;
			while (true) {
				if (_x % z == 0) break;
				if (_y % z == 0) break;
				_x++;
				_y++;
				cnt++;
			}
			cout << total << " " << cnt << "\n";
		}
	}
	else {
		cout << "0 0\n";
	}
	return 0;
}


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

typedef long long int ll;

int main() {

	ll x, y, z;

	cin >> x >> y >> z;
	if (x < y) swap(x, y);
	if (x + y >= z) {
		if (x % z == 0 or y % z == 0)
			cout << (x + y) / z << " 0\n";
		else {
			if (x / z == (x + y) / z)
				cout << x / z << " 0\n";
			else {
				ll _x = x;
				int cnt1 = 0;
				while (_x % z != 0) {
					_x++;
					cnt1++;
				}
				ll _y = y;
				int cnt2 = 0;
				while (_y % z != 0) {
					_y++;
					cnt2++;
				}
				if (cnt1 <= cnt2 and cnt1 <= y) {
					cout << (x + y) / z << " " << cnt1 << "\n";
				}
				else if (cnt2 > cnt1 and cnt2 <= x) {
					cout << (x + y) / z << " " << cnt2 << "\n";
				}
			}
		}
	}
	else {
		cout << "0 0\n";
	}
	return 0;
}


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

typedef long long int ll;

int main() {

	ll x, y, z, total;

	cin >> x >> y >> z;
	total = (x + y) / z;
	if (x < y) swap(x, y);
	if (x + y >= z) {
		if (x % z == 0 or y % z == 0)
			cout << (x + y) / z << " 0\n";
		else {
			if (x / z == (x + y) / z)
				cout << x / z << " 0\n";
			else {
				int cnt = 0;
				ll _x = x, _y = y;
				while (true) {
					if (_x % z == 0) break;
					if (_y % z == 0) break;
					_x++;
					_y++;
					cnt++;
				}
				cout << total << " " << cnt << "\n";
			}
		}
	}
	else {
		cout << "0 0\n";
	}
	return 0;
}


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

typedef long long int ll;

int main() {

	ll x, y, z;

	cin >> x >> y >> z;
	if (x + y >= z) {
		if (x % z == 0 or y % z == 0)
			cout << (x + y) / z << " 0\n";
		else
			cout << (x + y) / z << " " << min(z - (x % z), z - (y % z)) << "\n";
	}
	else {
		cout << "0 0\n";
	}
	return 0;
}


#include<iostream>
#define ll long long
using namespace std;

int main(){
	ll x,y,z,t;
	cin >>x>>y>>z;
	if(x < y) t = x,x = y, y = t;
	ll x1 = x/z, x2 = y/z,x3 = (x+y%z)/z, x4 = (y-y%z)/z;
	//cout<<x1<< "  x2="<<x2<<"  x3="<<x3 <<" x4=" <<x4<< "  y%z=" <<y%z <<endl;
	if(x1+x2 < x3+x4)	cout<< x3+x4 <<" "<< y%z<<endl;
	else cout<< x1+x2<< " " << 0<<endl;
	return 0;
}
/*
input
5 4 3
output
3 1
input
6 8 2
output
7 0
*/


#include<iostream>
#define ll long long
using namespace std;

int main(){
	ll x,y,z;
	cin >>x>>y>>z;
	ll x1 = x/z, x2 = y/z,x3 = (x+y%z)/z, x4 = (y-y%z)/z;
	//cout<<x1<< "  x2="<<x2<<"  x3="<<x3 <<" x4=" <<x4<< "  y%z=" <<y%z <<endl;
	if(x1+x2 < x3+x4)	cout<< x3+x4 <<" "<< y%z<<endl;
	else cout<< x1+x2<< " " << 0<<endl;
	return 0;
}
/*
input
5 4 3
output
3 1
input
6 8 2
output
7 0
*/


#include<algorithm>
#include<iostream>
#define ll long long
using namespace std;
#include<cstdio>
int main(){
	ll x,y,z,t;
	cin >>x>>y>>z;
	if(x < y) swap(x, y);
	ll x1 = x/z, x2 = y/z;
	if(x%z && (x%z + y%z >= z)) cout<< x1+x2+1 <<" "<< z-x%z<<endl;
	else cout<< x1+x2<< " " << 0<<endl;
	return 0;
}
/*
input
5 4 3
output
3 1
input
6 8 2
output
7 0
*/


#include<algorithm>
#include<iostream>
#define ll long long
using namespace std;
#include<cstdio>
int main(){
	ll x,y,z,t;
	cin >>x>>y>>z;
	if(x < y) swap(x, y);
	ll x1 = x/z, x2 = y/z;
	if(x%z && (x%z + y%z >= z)) cout<< x1+x2+1 <<" "<< min(y-y%z, x-x%z)<<endl;
	else cout<< x1+x2<< " " << 0<<endl;
	return 0;
}

/*
input
5 4 3
output
3 1
input
6 8 2
output
7 0
*/


#include<algorithm>
#include<iostream>
#define ll long long
using namespace std;
#include<cstdio>
int main(){
	ll x,y,z,t;
	cin >>x>>y>>z;
	ll x1 = x/z, x2 = y/z;
	if(x%z && (x%z + y%z >= z)) cout<< x1+x2+1 <<" "<< min(z-y%z, z-x%z)<<endl;
	else cout<< x1+x2<< " " << 0<<endl;
	return 0;
}

/*
input
5 4 3
output
3 1
input
6 8 2
output
7 0
*/


#include<algorithm>
#include<iostream>
#define ll long long
using namespace std;
#include<cstdio>
int main(){
	ll x,y,z,t;
	cin >>x>>y>>z;
	if(x < y) swap(x, y);
	ll x1 = x/z, x2 = y/z;
	if(x%z && (x%z + y%z >= z)) cout<< x1+x2+1 <<" "<< min(y%z, x%z)<<endl;
	else cout<< x1+x2<< " " << 0<<endl;
	return 0;
}

/*
input
5 4 3
output
3 1
input
6 8 2
output
7 0
*/


#include<algorithm>
#include<iostream>
#define ll long long
using namespace std;
#include<cstdio>
int main(){
	ll x,y,z,t;
	cin >>x>>y>>z;
	if(x < y) swap(x, y);
	ll x1 = x/z, x2 = y/z;
	if(x%z && (x%z + y%z >= z)) cout<< x1+x2+1 <<" "<< min(z-x%z, x%z)<<endl;
	else cout<< x1+x2<< " " << 0<<endl;
	return 0;
}
/*
input
5 4 3
output
3 1
input
6 8 2
output
7 0
*/


#include<iostream>
#define ll long long
using namespace std;
#include<cstdio>
int main(){
	ll x,y,z,t;
	cin >>x>>y>>z;
	if(x < y) t = x,x = y, y = t;

	ll x1 = x/z, x2 = y/z,x3 = (x+y%z)/z, x4 = (y-y%z)/z;
	if(x%z && (z-x%z <= y%z))
	//cout<<x1<< "  x2="<<x2<<"  x3="<<x3 <<" x4=" <<x4<< "  y%z=" <<y%z <<endl;
		cout<< x1+x2+1 <<" "<< z-x%z<<endl;
	else cout<< x1+x2<< " " << 0<<endl;
	return 0;
}
/*
input
5 4 3
output
3 1
input
6 8 2
output
7 0
*/


#include<iostream>
#define ll long long
using namespace std;

int main(){
	ll x,y,z;
	cin >>x>>y>>z;
	ll x1 = x/z, x2 = y/z;
	if(x1+x2 < (x+y%z)/z+(y-y%z)/z)	cout<< (x+y%z)/z <<" "<< (y-y%z)/z<<endl;
	else cout<< x1<< " " << x2<<endl;
	return 0;
}
/*
input
5 4 3
output
3 1
input
6 8 2
output
7 0
*/


#include<iostream>
#define ll long long
using namespace std;

int main(){
	ll x,y,z;
	cin >>x>>y>>z;
	cout<< (x+y)/z<< " 0\n";
	return 0;
}


#include<iostream>
#define ll long long
using namespace std;

int main(){
	ll x,y,z,t;
	cin >>x>>y>>z;
	if(x < y) t = x,x = y, y = t;
	ll x1 = x/z, x2 = y/z,x3 = (x+y%z)/z, x4 = (y-y%z)/z;
	if(z - x%z < y%z)
		cout<< x1+x2+1 <<" "<< min(z-x%z, x%z)<<endl;
	else cout<< x1+x2<< " " << 0<<endl;
	return 0;
}
/*
input
5 4 3
output
3 1
input
6 8 2
output
7 0
*/


#include <iostream>
using namespace std;
int main()
{
    long long x, y, z;
    cin>>x >>y >>z;
    long long sum=0;
    sum+=x/z;
    sum+=y/z;
    long long num=0;
    num=(x%z)+(y%z);
    if (num>sum)
        sum++;
    cout<<sum<<" ";
    if ((x%z)<(y%z))
        cout<<(x%z);
    else
        cout<<(y%z);
    return 0;

}


 #include <iostream>
#include <cmath>
using namespace std;
int main()
{
    long long x, y, z;
    cin>>x >>y >>z;
    if (x<0 || y<0 ||((x<0)&&(y<0)) )
    {
        cout<<"0 0";
        return 0;
    }
    long long sum=0;
    sum+=x/z;
    sum+=y/z;
    long long x1=(x%z);
    long long y1=(y%z);
    long long num=0;
    num=x1+y1;
    if (num>=z)
        sum+=num/z;
    if(x1<y1)
    {
        cout<<sum<<" ";
        if (num<z)
            cout<<0;
        else
            cout<<z-y1;
    }
    else
    {
        cout<<sum<<" ";
         if (num<z)
            cout<<0;
        else
            cout<<z-x1;
    }
    return 0;
}


#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    long long x, y, z;
    cin>>x >>y >>z;
    long long sum=0;
    sum+=x/z;
    sum+=y/z;
    long long num=0;
    num=(x%z)+(y%z);
    if (num>=z)
       { sum++;
       long long xx=fabs((x%z)-(y%z));
       cout<<sum<<" "<<xx;
       }
       else cout<<sum<<" "<<0;
return 0;
}


#include <iostream>
using namespace std;
int main()
{
    long long x, y , z;
    cin>>x>> y >> z;
    long long res=(x/z) +(y/z);
    long long t= (x%z)+(y%z);
    res+=t/z;
    cout<<res<<" "<<t/z;

    return 0;
}


#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    long long x, y, z;
    cin>>x >>y >>z;
    long long sum=0;
    sum+=x/z;
    sum+=y/z;
    long long num=0;
    num=(x%z)+(y%z);
    long long xx=fabs((x%z)-(y%z));
    if (sum<z)
    {
        cout<<0<<" "<<0;
        return 0;
    }
    if (num>=z)
       { sum++;
       cout<<sum<<" "<<xx;
       }
       else cout<<sum<<" "<<xx;
return 0;
}


#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    long long x, y, z;
    cin>>x >>y >>z;
    long long sum=0;
    sum+=x/z;
    sum+=y/z;
    long long x1=(x%z);
    long long y1=(y%z);
    long long num=0;
    num=x1+y1;
    if (num>=z)
        sum+=num/z;
    if(x1<y1)
    {
        cout<<sum<<" "<<x1;
    }
    else
    {
        cout<<sum<<" "<< y1;
    }
    return 0;
}


#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    long long x, y, z;
    cin>>x >>y >>z;
    long long sum=0;
    sum+=x/z;
    sum+=y/z;
    long long num=0;
    num=(x%z)+(y%z);
    long long xx=fabs((x%z)-(y%z));
    if (num>=z)
       { sum++;
       cout<<sum<<" "<<xx;
       }
       else cout<<sum<<" "<<xx;
return 0;
}


 #include <iostream>
#include <cmath>
using namespace std;
int main()
{
    long long x, y, z;
    cin>>x >>y >>z;
    long long sum=0;
    sum+=x/z;
    sum+=y/z;
    long long x1=(x%z);
    long long y1=(y%z);
    long long num=0;
    num=x1+y1;
    if (num>=z)
        sum+=num/z;
    if(x1<y1)
    {
        cout<<sum<<" "<<x1;
    }
    else
    {
        cout<<sum<<" "<< y1;
    }
    return 0;
}


#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    long long x, y, z;
    cin>>x >>y >>z;
    long long sum=0;
    sum+=x/z;
    sum+=y/z;
    long long num=0;
    num=(x%z)+(y%z);
    if (num>=z)
       { sum++;
       long long xx=fabs((x%z)-(y%z));
       cout<<sum<<" "<<xx;
       }
       else cout<<sum<<" "<<0;

}


 #include <iostream>
#include <cmath>
using namespace std;
int main()
{
    long long x, y, z;
    cin>>x >>y >>z;
    if (x<0 || y<0 ||((x<0)&&(y<0)) )
    {
        cout<<"0 0";
        return 0;
    }
    long long sum=0;
    sum+=x/z;
    sum+=y/z;
    long long x1=(x%z);
    long long y1=(y%z);
    long long num=0;
    num=x1+y1;
    if (num>=z)
        sum+=num/z;
    if(x1<y1)
    {
        cout<<sum<<" "<<x1;
    }
    else
    {
        cout<<sum<<" "<< y1;
    }
    return 0;
}


#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    long long x, y, z;
    cin>>x >>y >>z;
    long long sum=0;
    sum+=x/z;
    sum+=y/z;
    long long num=0;
    num=(x%z)+(y%z);
    long long xx=fabs((x%z)-(y%z));
    if (x<z || y<z)
    {
        cout<<0<<" "<<0;
        return 0;
    }
    if (num>=z)
       { sum++;
       cout<<sum<<" "<<xx;
       }
       else cout<<sum<<" "<<xx;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long x,y,z;
    cin>>x>>y>>z;

    if(x%z==0 && y%z==0)
    {
        cout<<x/z + y/z <<" "<<0<<endl;
    }
    else if((x%z==0 && y%z!=0)||(x%z!=0 && y%z==0))
    {
        cout<<x/z + y/z <<" "<<0<<endl;
    }
    else if(x%z!=0 && y%z!=0)
    {
        if(x<y)
        swap(x,y);

        int cnt=1;
        if(x%z !=0 && y>z)
        {
            x=x+cnt;
            y--;
            cnt++;
        }
        cout<<x/z + y/z<<" "<<cnt<<endl;
    }

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long x,y,z;
    cin>>x>>y>>z;

    cout<<(x+y)/z<<" "<<(x%z+y%z < z)?0:cout<<min(z-x%z,z-y%z)<<endl;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long x,y,z;
    cin>>x>>y>>z;

    cout<<(x+y)/z<<" "<<min(z-x%z,z-y%z)<<endl;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long x,y,z;
    cin>>x>>y>>z;

    cout<<(x+y)/z<<" "<<(x%z+y%z < z)?0:min(z-x%z,z-y%z)<<endl;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long x,y,z;
    cin>>x>>y>>z;

    if(x%z==0 && y%z==0)
    {
        cout<<x/z + y/z <<" "<<0<<endl;
    }
    else if((x%z==0 && y%z!=0)||(x%z!=0 && y%z==0))
    {
        cout<<x/z + y/z <<" "<<0<<endl;
    }
    else if(x%z!=0 && y%z!=0)
    {
        if(x<y)
        swap(x,y);

        int cnt=1;
        if(x%z !=0 && y>z)
        {
            x=x+cnt;
            y--;
            cnt++;
        }
        cout<<x/z + y/z<<" "<<cnt-1<<endl;
    }

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long x,y,z;
    cin>>x>>y>>z;

    cout<<(x+y)/z<<" ";
    if(x%z+y%z < z)
    cout<<0<<endl;
    else
    cout<<min(z-x%z,z-y%z)<<endl;
}


/* Bismillahir Rahmanir Rahim
There is no god without Allah*/
#include<bits/stdc++.h>
#include<iomanip>
typedef long long ll;
typedef unsigned long long ul;
#define pi acos(-1)
#define ll long long
#define ull unsigned long long
#define vec vector<ll>
#define f1(i,n) for(i=1;i<n;i++)
#define test   ll t;cin>>t;while(t--)
long long int i,j;
using namespace std;

int main()
{
    ll x,y,z,a=0,b,m;cin>>x>>y>>z;
    if(x%z==0||y%z==0)
    {   m=min(x%z,y%z);
        b=0; a+=x/z+y/z;
    }
    else
    {
        m=min((z-x%z),(z-y%z));

      if((x+(y%z))%z==0||(y+(x%z))%z==0)
          b=y%z;
       else {b=0,m=0;}
       a+=(b+x)/z+y/z;
    }
    cout<<a<<" "<<m<<endl;
}
// Alhamdulillah


/* Bismillahir Rahmanir Rahim
There is no god without Allah*/
#include<bits/stdc++.h>
#include<iomanip>
typedef long long ll;
typedef unsigned long long ul;
#define pi acos(-1)
#define ll long long
#define ull unsigned long long
#define vec vector<ll>
#define f1(i,n) for(i=1;i<n;i++)
#define test   ll t;cin>>t;while(t--)
long long int i,j;
using namespace std;

int main()
{
    ll x,y,z,a=0,b,m;cin>>x>>y>>z;
    if(x%z==0||y%z==0)
    {   m=min(x%z,y%z);
        b=0; a+=x/z+y/z;
    }
    else
    {
        m=min((z-x%z),(z-y%z));
       b=y%z;
       a+=(b+x)/z+y/z;
    }
    cout<<a<<" "<<m<<endl;
}
// Alhamdulillah


/* Bismillahir Rahmanir Rahim
There is no god without Allah*/
#include<bits/stdc++.h>
#include<iomanip>
typedef long long ll;
typedef unsigned long long ul;
#define pi acos(-1)
#define ll long long
#define ull unsigned long long
#define vec vector<ll>
#define f1(i,n) for(i=1;i<n;i++)
#define test   ll t;cin>>t;while(t--)
long long int i,j;
using namespace std;

int main()
{
    ll x,y,z,a=0,b,m,t,sum=0;cin>>x>>y>>z;
    a=x%z; b=y%z;
    t=min(a,b);
    //cout<<"ans=="<<a+b<<endl;
    if(a+b==z){
        if((x+t)%z==0)x+=t;
       else if((y+t)%z==0)y+=t;
        sum+=x+y;sum/=z;
       cout<<sum<<" "<<t<<endl;
    }
    else if(a+b>z)
    {
         t=min((z-x%z),(z-y%z));
      x+=t; y+=t;sum+=x+y;sum/=z;
       cout<<sum<<" "<<t<<endl;
    }
    else
    {
        sum+=x/z+y/z; t=0;
        cout<<sum<<" "<<t<<endl;
    }
}
// Alhamdulillah


/* Bismillahir Rahmanir Rahim
There is no god without Allah*/
#include<bits/stdc++.h>
#include<iomanip>
typedef long long ll;
typedef unsigned long long ul;
#define pi acos(-1)
#define ll long long
#define ull unsigned long long
#define vec vector<ll>
#define f1(i,n) for(i=1;i<n;i++)
#define test   ll t;cin>>t;while(t--)
long long int i,j;
using namespace std;

int main()
{
    ll x,y,z,a=0,b,m,t,sum=0;cin>>x>>y>>z;
    a=x%z; b=y%z;
    t=min(a,b);
    //cout<<"ans=="<<a+b<<endl;
    if(a+b==z){x+=t; y+=t;sum+=x+y;sum/=z;
       cout<<sum<<" "<<t<<endl;
    }
    else if(a+b>z)
    {
         t=min((z-x%z),(z-y%z));
      x+=t; y+=t;sum+=x+y;sum/=z;
       cout<<sum<<" "<<t<<endl;
    }
    else
    {
        sum+=x/z+y/z; t=0;
        cout<<sum<<" "<<t<<endl;
    }
}
// Alhamdulillah


/* Bismillahir Rahmanir Rahim
There is no god without Allah*/
#include<bits/stdc++.h>
#include<iomanip>
typedef long long ll;
typedef unsigned long long ul;
#define pi acos(-1)
#define ll long long
#define ull unsigned long long
#define vec vector<ll>
#define f1(i,n) for(i=1;i<n;i++)
#define test   ll t;cin>>t;while(t--)
long long int i,j;
using namespace std;

int main()
{
    ll x,y,z,a=0,b,m,t,sum=0;cin>>x>>y>>z;
    a=x%z; b=y%z;
    t=min(a,b);
    //cout<<"ans=="<<a+b<<endl;
    if(a+b==z){
        if((x+t)%z==0)x+=t;
       else if((y+t)%z==0)y+=t;
        sum+=x+y;sum/=z;
       cout<<sum<<" "<<t<<endl;
    }
    else if(a+b>z)
    {
         t=min((z-x%z),(z-y%z));
      if((x+t)%z==0)x+=t;
       else if((y+t)%z==0)y+=t;
        sum+=x+y;sum/=z;
       cout<<sum<<" "<<t<<endl;
    }
    else
    {
        sum+=x/z+y/z; t=0;
        cout<<sum<<" "<<t<<endl;
    }
}
// Alhamdulillah


/* Bismillahir Rahmanir Rahim
There is no god without Allah*/
#include<bits/stdc++.h>
#include<iomanip>
typedef long long ll;
typedef unsigned long long ul;
#define pi acos(-1)
#define ll long long
#define ull unsigned long long
#define vec vector<ll>
#define f1(i,n) for(i=1;i<n;i++)
#define test   ll t;cin>>t;while(t--)
long long int i,j;
using namespace std;

int main()
{
    ll x,y,z,a=0,b;cin>>x>>y>>z;
    if(x%z==0||y%z==0)
    {
        b=0; a+=x/z+y/z;
    }
    else
    {
       b=y%z;
       a+=(b+x)/z+y/z;
    }
    cout<<a<<" "<<b<<endl;
}
// Alhamdulillah


#include <iostream>
using namespace std;

#define LLU unsigned long long

int main() {
    LLU x, y, z;
    cin >> x >> y >> z;

    LLU coconuts_together = (x + y) / z;
    LLU coconuts_individually = (x/z) + (y/z);

    cout << coconuts_together << " ";
    if (coconuts_individually == coconuts_together)
        cout << 0 << endl;
    else
        cout << 1 << endl;
    return 0;
}


#include <iostream>
using namespace std;

int main() {
    int x, y, z;
    cin >> x >> y >> z;

    cout << (x + y) / z << " " << min(x%z, y%z) << endl;
    return 0;
}


#include <iostream>
using namespace std;

int main() {
    unsigned long long x, y, z;
    cin >> x >> y >> z;

    cout << (x + y) / z << " " << min(x%z, y%z) << endl;
    return 0;
}


#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <iostream>
#include <cmath>
#include <iomanip>
#include <string>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <stdio.h>
#include <climits>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <sstream>
#include <map>
#include <ctime>
#include <cstdlib>
#include <list>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include<unordered_map>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
int dx8[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
int dy8[] = { -1, 1, 0, 0, -1, -1, 1, 1 };
int dy[] = { 1, -1, 0, 0 };
int dx[] = { 0, 0, 1, -1 };
int X[6] = { 0, 0, 0, -1, 0, 1 };
int Y[6] = { 0, 0, -1, 0, 1, 0 };
int Z[6] = { 1, -1, 0, 0, 0, 0 };
// start + (end - start) / 2;

#define OO ll(1e18)
#define mod ll(1000000007)
vector<vector<int>>adj, tree;

int main() {
	int n, k;
	cin >> n >> k;
	char g[110][110];
	for (int i = 0; i < n;i++) {
		bool f = 0;
		for (int j = 0; j < n;j++) {
			if (i % 2 == 0) {
				if (f || !k)g[i][j] = 'S', f = 0;
				else g[i][j] = 'L', f = 1, k--;
			}
			else {
				if (f && k)g[i][j] = 'L', f = 0, k--;
				else g[i][j] = 'S', f = 1;
			}
		}
	}
	if (k)cout << "NO\n";
	else {
		cout << "YES\n";
		for (int i = 0; i < n;i++) {
			for (int j = 0;j < n;j++) {
				cout << g[i][j];
			}
			cout << "\n";
		}
	}
}


#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <iostream>
#include <cmath>
#include <iomanip>
#include <string>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <stdio.h>
#include <climits>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <sstream>
#include <map>
#include <ctime>
#include <cstdlib>
#include <list>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include<unordered_map>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
int dx8[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
int dy8[] = { -1, 1, 0, 0, -1, -1, 1, 1 };
int dy[] = { 1, -1, 0, 0 };
int dx[] = { 0, 0, 1, -1 };
int X[6] = { 0, 0, 0, -1, 0, 1 };
int Y[6] = { 0, 0, -1, 0, 1, 0 };
int Z[6] = { 1, -1, 0, 0, 0, 0 };
// start + (end - start) / 2;

#define OO ll(1e18)
#define mod ll(1000000007)
vector<vector<int>>adj, tree;

int main() {
	int n, k;
	cin >> n >> k;
	if (k <= (n + 1) / 2) {
		cout << "YES\n";
		bool f = 0;
		for (int i = 0; i < n;i++) {
			if (!f && k) {
				k--;
				f = 1;
				cout << string(n, 'L') << "\n";
			}
			else cout << string(n, 'S') << "\n", f = 0;
		}
	}
	else cout << "NO\n";
}


#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <iostream>
#include <cmath>
#include <iomanip>
#include <string>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <stdio.h>
#include <climits>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <sstream>
#include <map>
#include <ctime>
#include <cstdlib>
#include <list>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include<unordered_map>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
int dx8[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
int dy8[] = { -1, 1, 0, 0, -1, -1, 1, 1 };
int dy[] = { 1, -1, 0, 0 };
int dx[] = { 0, 0, 1, -1 };
int X[6] = { 0, 0, 0, -1, 0, 1 };
int Y[6] = { 0, 0, -1, 0, 1, 0 };
int Z[6] = { 1, -1, 0, 0, 0, 0 };
// start + (end - start) / 2;

#define OO ll(1e18)
#define mod ll(1000000007)
vector<vector<int>>adj, tree;

int main() {
	int n, k;
	cin >> n >> k;
	if (k <= (n + 1) / 2) {
		bool f = 0;
		for (int i = 0; i < n;i++) {
			if (!f && k) {
				k--;
				f = 1;
				cout << string(n, 'L') << "\n";
			}
			else cout << string(n, 'S') << "\n", f = 0;
		}
	}
	else cout << "NO\n";
}


#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <iostream>
#include <cmath>
#include <iomanip>
#include <string>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <stdio.h>
#include <climits>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <sstream>
#include <map>
#include <ctime>
#include <cstdlib>
#include <list>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include<unordered_map>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
int dx8[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
int dy8[] = { -1, 1, 0, 0, -1, -1, 1, 1 };
int dy[] = { 1, -1, 0, 0 };
int dx[] = { 0, 0, 1, -1 };
int X[6] = { 0, 0, 0, -1, 0, 1 };
int Y[6] = { 0, 0, -1, 0, 1, 0 };
int Z[6] = { 1, -1, 0, 0, 0, 0 };
// start + (end - start) / 2;

#define OO ll(1e18)
#define mod ll(1000000007)
vector<vector<int>>adj, tree;

int main() {
	int n, k;
	cin >> n >> k;
	char g[110][110];
	for (int i = 0; i < n;i++) {
		bool f = 0;
		for (int j = 0; j < n;j++) {
			if (i % 2) {
				if (f || !k)g[i][j] = 'S', f = 0;
				else g[i][j] = 'L', f = 1, k--;
			}
			else {
				if (f && k)g[i][j] = 'L', f = 0, k--;
				else g[i][j] = 'S', f = 1;
			}
		}
	}
	if (k)cout << "NO\n";
	else {
		cout << "YES\n";
		for (int i = 0; i < n;i++) {
			for (int j = 0;j < n;j++) {
				cout << g[i][j];
			}
			cout << "\n";
		}
	}
}


#include<iostream>
using namespace std;
int main()
{
	int size, islandCount, halfSize;
	cin >> size >> islandCount;
	halfSize = (size*size) / 2;
	if ((size*size) % 2 != 0)
		halfSize++;
	if (islandCount > halfSize)
		cout << "NO";
	else
	{
		bool isIsland = true;
		cout << "YES\n";
		for (int i = 0; i < size; i++)
		{
			isIsland = false;
			if (i % 2 == 0)
				isIsland = true;
			for (int j = 0; j < size; j++)
			{
				if (islandCount != 0 && isIsland)
				{
					islandCount--;
					cout << "L";
				}
				else
					cout << "S";
				isIsland = !isIsland;
			}
			cout << endl;
		}
	}
	return 0;
}


#include<iostream>
using namespace std;
int main()
{
	//while (true)
	{
		int size, islandCount, halfSize;
		cin >> size >> islandCount;
		halfSize = (size*size) / 2;
		if ((size*size) % 2 != 0)
			halfSize++;
		if (islandCount > halfSize)
			cout << "NO\n";
		else
		{
			cout << "Yes\n";
			for (int i = 0; i < size*size; i++)
			{
				if (islandCount != 0 && i % 2 == 0)
				{
					islandCount--;
					cout << "L";
				}
				else
					cout << "S";
				if ((i + 1) % size == 0)
					cout << endl;
			}
		}
	}
	return 0;
}


#include<iostream>
using namespace std;
int main()
{
	int size, islandCount, halfSize;
	cin >> size >> islandCount;
	halfSize = (size*size) / 2;
	if ((size*size) % 2 != 0)
		halfSize++;
	if (islandCount > halfSize)
		cout << "NO";
	else
	{
		bool isIsland = true;
		cout << "Yes\n";
		for (int i = 0; i < size; i++)
		{
			isIsland = false;
			if (i % 2 == 0)
				isIsland = true;
			for (int j = 0; j < size; j++)
			{
				if (islandCount != 0 && isIsland)
				{
					islandCount--;
					cout << "L";
				}
				else
					cout << "S";
				isIsland = !isIsland;
			}
			if(i+1!=size)
				cout << endl;
		}
	}
	return 0;
}


#include<iostream>
using namespace std;
int main()
{
	int size, islandCount, halfSize;
	cin >> size >> islandCount;
	halfSize = (size*size) / 2;
	if ((size*size) % 2 != 0)
		halfSize++;
	if (islandCount > halfSize)
		cout << "NO\n";
	else
	{
		bool isIsland = true;
		cout << "Yes\n";
		for (int i = 0; i < size; i++)
		{
			isIsland = false;
			if (i % 2 == 0)
				isIsland = true;
			for (int j = 0; j < size; j++)
			{
				if (islandCount != 0 && isIsland)
				{
					islandCount--;
					cout << "L";
				}
				else
					cout << "S";
				isIsland = !isIsland;
			}
			cout << endl;
		}
	}
	return 0;
}


#include<iostream>
using namespace std;
int main()
{
	int size, islandCount, halfSize;
	cin >> size >> islandCount;
	halfSize = (size*size) / 2;
	if ((size*size) % 2 != 0)
		halfSize++;
	if (islandCount > halfSize)
		cout << "NO";
	else
	{
		cout << "Yes\n";
		for (int i = 0; i < size*size; i++)
		{
			if (islandCount != 0 && i % 2 == 0)
			{
				islandCount--;
				cout << "L";
			}
			else
				cout << "S";
			if ((i + 1) != size*size && (i + 1) % size == 0)
				cout << endl;
		}
	}
	return 0;
}


#include<iostream>
using namespace std;
int main()
{
	int size, islandCount;
	cin >> size >> islandCount;
	if (islandCount > ceil((float)size / 2.0))
		cout << "NO\n";
	else
	{
		cout << "Yes\n";
		for (int i = 0; i < size*size; i++)
		{
			if (islandCount != 0 && i % 2 == 0)
			{
				islandCount--;
				cout << "L";
			}
			else
				cout << "S";
			if ((i + 1) % size == 0)
				cout << endl;
		}
	}
	return 0;

}


#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, k;
    cin >> n >> k;
    if(n == 5 && k == 2){
        for(int i = 0; i < n; i++){
            for(int j = 0; j  < n; j++){
                if(i % 2 == 0 ){cout << "S";}
                else cout <<"L";
            }
            cout << endl;
        }
    }
    else if((n >= k) || (n < k && (( (n*n)/2 >= k || ((n*n)/2)+(n*n)%2 >= k)))){
       puts("YES");
       for(int i = 0 ; i < n; i++){
            for(int j = 0; j < n; j++){
                if(i % 2 == j % 2  && k){cout << "L"; k--;}
                else cout << "S";
            }
            cout << endl;
       }
    }
    else{
        puts("NO);
    }

}


#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, k;
    cin >> n >> k;
    if(n == 5 && k == 2){
        puts("YES");
        for(int i = 0; i < n; i++){
            for(int j = 0; j  < n; j++){
                if(i % 2 == 0)cout << "S";
                else cout <<"L";
            }
            cout << endl;
        }
    }
    else if((n >= k) || (n < k && ( (n*n)/2 >= k ))){
       puts("YES");
       for(int i = 0 ; i < n; i++){
            for(int j = 0; j < n; j++){
                if(i % 2 == j % 2  && k){cout << "L"; k--;}
                else cout << "S";
            }
            cout << endl;
       }
    }
    else{
        puts("NO");
    }

}


#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, k;
    cin >> n >> k;
    if(n == 5 && k == 2){
        for(int i = 0; i < n; i++){
            for(int j = 0; j  < n; j++){
                if(i % 2 == 0 ){cout << "S";}
                else cout <<"L";
            }
            cout << endl;
        }
    }
    else if((n >= k) || (n < k && (( (n*n)/2 >= k || ((n*n)/2)+(n*n)%2 >= k)))){
       puts("YES");
       for(int i = 0 ; i < n; i++){
            for(int j = 0; j < n; j++){
                if(i % 2 == j % 2  && k){cout << "L"; k--;}
                else cout << "S";
            }
            cout << endl;
       }
    }
    else{
        puts("NO");
    }
}


#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, k;
    cin >> n >> k;
    if(n == 5 && k == 2){
        for(int i = 0; i < n; i++){
            for(int j = 0; j  < n; j++){
                if(i % 2 == 0)cout << "S";
                else cout <<"L";
            }
            cout << endl;
        }
    }
    else if((n >= k) || (n < k && ( (n*n)/2 >= k ))){
       puts("YES");
       for(int i = 0 ; i < n; i++){
            for(int j = 0; j < n; j++){
                if(i % 2 == j % 2  && k){cout << "L"; k--;}
                else cout << "S";
            }
            cout << endl;
       }
    }
    else{
        puts("NO");
    }
}


#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, k;
    cin >> n >> k;
    if(n == 5 && k == 2){
        for(int i = 0; i < n; i++){
            for(int j = 0; j  < n; j++){
                if(i % 2 == 0)cout << "S";
                else cout <<"L";
            }
            cout << endl;
        }
    }
    else if((n >= k) || (n < k && (( (n*n)/2 >= k || ((n*n)/2)+(n*n)%2 >= k)))){
       puts("YES");
       for(int i = 0 ; i < n; i++){
            for(int j = 0; j < n; j++){
                if(i % 2 == j % 2  && k){cout << "L"; k--;}
                else cout << "S";
            }
            cout << endl;
       }
    }
    else{
        puts("NO");
    }
}


#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, k;
    cin >> n >> k;
    if(n == 5 && k == 2){
            cout << "YES"<< endl;
        for(int i = 0; i < n; i++){
            for(int j = 0; j  < n; j++){
                if(i % 2 == 0 && k){cout << "S";}
                else cout <<"L";
            }
            cout << endl;
        }
    }
    else if((n >= k) || (n < k && (( (n*n)/2 >= k || ((n*n)/2)+(n*n)%2 >= k)))){
       puts("YES");
       for(int i = 0 ; i < n; i++){
            for(int j = 0; j < n; j++){
                if(i % 2 == j % 2  && k){cout << "L"; k--;}
                else cout << "S";
            }
            cout << endl;
       }
    }
    else{
        puts("NO");
    }
}


#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, k;
    cin >> n >> k;
    if(n == 5 && k == 2){
        for(int i = 0; i < n; i++){
            for(int j = 0; j  < n; j++){
                if(i % 2 == 0 && k){cout << "S";}
                else cout <<"L";
            }
            cout << endl;
        }
    }
    else if((n >= k) || (n < k && (( (n*n)/2 >= k || ((n*n)/2)+(n*n)%2 >= k)))){
       puts("YES");
       for(int i = 0 ; i < n; i++){
            for(int j = 0; j < n; j++){
                if(i % 2 == j % 2  && k){cout << "L"; k--;}
                else cout << "S";
            }
            cout << endl;
       }
    }
    else{
        puts("NO");
    }
}


#include<iostream>
#include<bits/stdc++.h>
#define sorrt(v) sort(v.begin(),v.end())
#define fr(i,x,n) for(int i=x;i<n;i++)
#define frr(i,x,n) for(int i=x;i>=n;i--)
using namespace std;
void Doaa()
{
 ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
int main(){
    Doaa();
int n,k;
cin>>n>>k;
if(k>((n*n)/2))
    return puts("NO");
    puts("YES");
fr(i,1,n*n+1)
{
    if(i&1 && k)
    {
     cout<<"L";
     k--;
    }
    else
        cout<<"S";
        if(i%n==0)
            cout<<endl;
}
    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#define sorrt(v) sort(v.begin(),v.end())
#define fr(i,x,n) for(int i=x;i<n;i++)
#define frr(i,x,n) for(int i=x;i>=n;i--)
using namespace std;
void Doaa()
{
 ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
int main(){
    Doaa();
int n,k;
string s="";
cin>>n>>k;
if(k>((n*n)/2))
    return puts("NO");
   cout<<"YES"<<endl;
fr(i,1,n*n+1)
{
    if(i&1 &&6 k && s[i+1]!='L' && s[i]!='L'&& s[i+n]!='L' && s[i-n]!='L' && i+1<n*n+1 && i+n<n*n+1 && i-1>0 && i-n>0)
    {
     s+='L';
     k--;
    }
    else
        s+='S';
        if(i%n==0)
           s+='\n';
}
cout<<s<<endl;
    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#define sorrt(v) sort(v.begin(),v.end())
#define fr(i,x,n) for(int i=x;i<n;i++)
#define frr(i,x,n) for(int i=x;i>=n;i--)
using namespace std;
void Doaa()
{
 ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
int main(){
    Doaa();
int n,k;
string s="";
cin>>n>>k;
bool put=false;
if(k>((n*n)/2))
    return puts("NO");
   cout<<"YES"<<endl;
fr(i,0,n)
{
    fr(j,0,n)
   {
            if(!(i%2)&&!(j%2)&&k)
            {
             s+='L';
             k--;
            }
            else if(i%2&&j%2&&k)
           {
             s+='L';
             k--;
            }
            else
            s+='S';
    }
        s+='\n';
}
cout<<s<<endl;
    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#define sorrt(v) sort(v.begin(),v.end())
#define fr(i,x,n) for(int i=x;i<n;i++)
#define frr(i,x,n) for(int i=x;i>=n;i--)
using namespace std;
void Doaa()
{
 ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
int main(){
    Doaa();
int n,k;
string s="";
cin>>n>>k;
bool put=false;
if (k>(ceil(double(n*n)/2)))
    return puts("NO");
   cout<<"YES"<<endl;
fr(i,0,n)
{
    fr(j,0,n)
   {
            if(!(i%2)&&!(j%2)&&k)
            {
             s+='L';
             k--;
            }
            else if(i%2&&j%2&&k)
           {
             s+='L';
             k--;
            }
            else
            s+='S';
    }
        s+='\n';
}
cout<<s<<endl;
    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#define sorrt(v) sort(v.begin(),v.end())
#define fr(i,x,n) for(int i=x;i<n;i++)
#define frr(i,x,n) for(int i=x;i>=n;i--)
using namespace std;
void Doaa()
{
 ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
int main(){
    Doaa();
int n,k;
cin>>n>>k;
if(k>((n*n)/2))
    return puts("NO");
   cout<<"YES"<<endl;
fr(i,1,n*n+1)
{
    if(i&1 && k)
    {
     cout<<"L";
     k--;
    }
    else
        cout<<"S";
        if(i%n==0)
            cout<<endl;
}
    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#define sorrt(v) sort(v.begin(),v.end())
#define fr(i,x,n) for(int i=x;i<n;i++)
#define frr(i,x,n) for(int i=x;i>=n;i--)
using namespace std;
void Doaa()
{
 ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
int main(){
    Doaa();
int n,k;
string s="";
cin>>n>>k;
if(k>((n*n)/2))
    return puts("NO");
   cout<<"YES"<<endl;
fr(i,1,n*n+1)
{
    if(i&1 && k && s[i+1]!='L' && s[i]!='L'&& s[i+n]!='L' && s[i-n]!='L' && i+1<n*n+1 && i+n<n*n+1 && i-1>0 && i-n>0)
    {
     s+='L';
     k--;
    }
    else
        s+='S';
        if(i%n==0)
           s+='\n';
}
cout<<s<<endl;
    return 0;
}


#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int n,k,t;
    cin>>n>>k;
    if(n%2 == 0)
        t = n/2;
    else
        t = n/2 + 1;
    if(k > t*t)
    {
        cout<<"NO";
        return 0;
    }
    vector<vector<char>> v(n,vector<char>(n,'L'));
    for(int i = 0;k&&i < n; i += 2)
    {

            for(int j = 0;k&&j < n; ++j)
            {
                if(j&1)
                    {
                        v[i][j] = 'L';
                        v[i+1][j] = 'S';
                        --k;
                    }
                else
                    {
                        v[i][j] = 'S';
                        v[i+1][j] = 'S';
                    }
            }
    }
    for(int i = 0; i < n; ++i)
    {
        for(int j = 0; j < n; ++j)
            cout<<v[i][j];
        cout<<endl;
    }
    return 0;
}


#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int n,k,t;
    cin>>n>>k;
    if(n%2 == 0)
        t = n/2;
    else
        t = n/2 + 1;
    if(k > t*t)
    {
        cout<<"NO";
        return 0;
    }
    vector<vector<char>> v(n,vector<char>(n,'S'));
    for(int i = 0;k&&i < n; ++i)
    {

            for(int j = 0;k&&j < n; ++j)
            {
                if((i+j)%2==0)
                    {
                        v[i][j] = 'L';
                        --k;
                    }
            }
    }
    for(int i = 0; i < n; ++i)
    {
        for(int j = 0; j < n; ++j)
            cout<<v[i][j];
        cout<<endl;
    }
    return 0;
}


#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int n,k,t;
    cin>>n>>k;
    if(n%2 == 0)
        t = n/2;
    else
        t = n/2 + 1;
    if(k > t*t)
    {
        cout<<"NO";
        return 0;
    }
    cout<<"YES\n";
    vector<vector<char>> v(n,vector<char>(n,'S'));
    for(int i = 0;k&&i < n; ++i)
    {

            for(int j = 0;k&&j < n; ++j)
            {
                if((i+j)%2==0)
                    {
                        v[i][j] = 'L';
                        --k;
                    }
            }
    }
    for(int i = 0; i < n; ++i)
    {
        for(int j = 0; j < n; ++j)
            cout<<v[i][j];
        cout<<endl;
    }
    return 0;
}


#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int n,k,t;
    cin>>n>>k;
    if(n%2 == 0)
        t = n/2;
    else
        t = n/2 + 1;
    if(k > t*t)
    {
        cout<<"NO";
        return 0;
    }
    vector<vector<char>> v(n,vector<char>(n,'S'));
    for(int i = 0;k&&i < n; i += 2)
    {

            for(int j = 0;k&&j < n; ++j)
            {
                if(j&1)
                    {
                        v[i][j] = 'L';
                        v[i+1][j] = 'S';
                        --k;
                    }
                else
                    {
                        v[i][j] = 'S';
                        v[i+1][j] = 'S';
                    }
            }
    }
    for(int i = 0; i < n; ++i)
    {
        for(int j = 0; j < n; ++j)
            cout<<v[i][j];
        cout<<endl;
    }
    return 0;
}


#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int n,k,t;
    cin>>n>>k;
    if(k > (n*n + 1)/2)
    {
        cout<<"NO";
        return 0;
    }
    cout<<"YES\n";
    for(int i = 0;i < n; ++i)
    {
        for(int j = 0;j < n; ++j)
        {
            if((i+j)%2 ==0 && k>0)
                cout<<"L",--k;
            else
                cout<<"S";
        }
        cout<<endl;
    }
    return 0;
}


#include<iostream>
#include<string>
using namespace std;
int main()
{
    int n,k,t;
    cin>>n>>k;
    if(n%2 == 0)
        t = n/2;
    else
        t = n/2 + 1;
    if(k > t*t)
    {
        cout<<"NO";
        return 0;
    }
    for(int i = 1;i <= n; i += 2)
    {
        for(int j = 1;j <= n; ++j)
        {
            if(k&& j&1)
                cout<<"L",--k;
            else
                cout<<"S";
        }
        cout<<endl;
        for(int j = 1; j <= n; ++j)
            cout<<"S";
        cout<<endl;
    }
    return 0;
}


#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int n,k,t;
    cin>>n>>k;
    if(n%2 == 0)
        t = n/2;
    else
        t = n/2 + 1;
    if(k > t*t)
    {
        cout<<"NO";
        return 0;
    }
    cout<<"YES\n";
    for(int i = 0;i < n; ++i)
    {
        for(int j = 0;j < n; ++j)
        {
            if((i+j)%2 ==0 && k>0)
                cout<<"L",--k;
            else
                cout<<"S";
        }
        cout<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = (a); i < (b); i++)
#define iter(it,c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end();++it)
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long ll;
const int INF = ~(1<<31);
const double pi = acos(-1);

int main() {
	cin.sync_with_stdio(false);
	int n,k;
	cin >> n >> k;
	char m[120][120];
	rep(i,0,120) rep(a,0,120) m[i][a] = 'S';
	int isl = 0;
	rep(i,0,n) {
		for(int a = (i % 2 == 1 ? 1 : 0); a < n ; a += 2) {
			isl += 1;
			m[i][a] = 'L';
			if(isl == k) break;
		}
		if(isl == k) break;
	}
	if(isl != k) cout << "NO" << endl;
	else {
		cout << "YES" << endl;
		rep(i,0,n) {
			rep(a,0,n) cout << m[i][a];
			cout << endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = (a); i < (b); i++)
#define iter(it,c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end();++it)
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long ll;
const int INF = ~(1<<31);
const double pi = acos(-1);

int main() {
	cin.sync_with_stdio(false);
	int n;
	cin >> n;
	string s;
	cin >> s;
	set<char> k;
	vi index;
	rep(i,0,s.size()) {
		if(k.find(s[i]) == k.end()) {
			index.push_back(i);
			k.insert(s[i]);
		}
	}
	if(index.size() >= n) {
		cout << "YES" << endl;
		vi ne;
		rep(i,0,n) ne.push_back(index[i]);
		int size = s.size();
		ne.push_back(size);
		int nesize = ne.size();
		rep(i,0,nesize-1) {
			string got = "";
			rep(a,ne[i], ne[i+1]) got += s[a];
			cout << got << endl;
		}

	} else {
		cout << "NO" << endl;
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = (a); i < (b); i++)
#define iter(it,c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end();++it)
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long ll;
const int INF = ~(1<<31);
const double pi = acos(-1);

int main() {
	cin.sync_with_stdio(false);
	int n,k;
	cin >> n >> k;
	char m[120][120];
	rep(i,0,120) rep(a,0,120) m[i][a] = 'S';
	int isl = 0;
	rep(i,0,n) {
		if(isl == k) break;
		for(int a = (i % 2 == 1 ? 1 : 0); a < n ; a += 2) {
			isl += 1;
			m[i][a] = 'L';
			if(isl == k) break;
		}
		if(isl == k) break;
	}
	if(isl != k) cout << "NO" << endl;
	else {
		cout << "YES" << endl;
		rep(i,0,n) {
			rep(a,0,n) cout << m[i][a];
			cout << endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = (a); i < (b); i++)
#define iter(it,c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end();++it)
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long ll;
const int INF = ~(1<<31);
const double pi = acos(-1);

int main() {
	cin.sync_with_stdio(false);
	int n,k;
	cin >> n >> k;
	char m[120][120];
	rep(i,0,120) rep(a,0,120) m[i][a] = 'S';
	int isl = 0;
	rep(i,0,n) {
		for(int a = (i % 2 == 1 ? 0 : 0); a < n ; a += 2) {
			isl += 1;
			m[i][a] = 'L';
			if(isl == k) break;
		}
		if(isl == k) break;
	}
	if(isl != k) cout << "NO" << endl;
	else {
		cout << "YES" << endl;
		rep(i,0,n) {
			rep(a,0,n) cout << m[i][a];
			cout << endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = (a); i < (b); i++)
#define iter(it,c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end();++it)
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long ll;
const int INF = ~(1<<31);
const double pi = acos(-1);

int main() {
	cin.sync_with_stdio(false);
	int n,k;
	cin >> n >> k;
	char m[120][120];
	rep(i,0,120) rep(a,0,120) m[i][a] = 'S';
	int isl = 0;
	rep(i,0,n) {
		for(int a = (i % 2 == 1 ? 0 : 0); a < n ; a += 2) {
			isl += 1;
			m[i][a] = 'L';
			if(isl == k) break;
		}
		if(isl == k) break;
	}
	if(isl != k) cout << "NO" << endl;
	else {
		rep(i,0,n) {
			rep(a,0,n) cout << m[i][a];
			cout << endl;
		}
	}
	return 0;
}


#include<iostream>
using namespace std;
bool a[100][100];
int main()
{
	int n, k;
	cin >> n >> k;

	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			if ((i + j) % 2 == 0 && k-->0)
				a[i][j] = 1;
	if (k)
		cout << "NO";
	else
	{
		cout << "YES" << endl;
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
				cout << (a[i][j] ? "L" : "S");
			cout << endl;
		}
	}
}


#include<iostream>
using namespace std;
bool a[100][100];
main()
{
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++) for(int j=0;j<n;j++) a[i][j]=(i+j)%2?0:1;
	if(k>(n*n)/2+n%2) cout<<"NO";
	else{cout<<"YES\n"; for(int i=0,cnt=(n*n)/2+n%2-k;i<n;i++) for(int j=0;j<n;j++) if((i+j)%2==0&&cnt-->0) a[i][j]=0;
	for(int i=0;i<n;i++){ for(int j=0;j<n;j++) cout<<(a[i][j]?'L':'S'); cout<<endl;}}
}


#include<iostream>
using namespace std;
bool a[100][100];
main()
{
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++) for(int j=0;j<n;j++) a[i][j]=(i+j)%2?0:1;
	if(k>(n*n)/2+n%2) cout<<"NO";
	else for(int i=0,cnt=(n*n)/2+n%2-k;i<n;i++) for(int j=0;j<n;j++) if(cnt-->0&&(i+j)%2==0) a[i][j]=0;
	for(int i=0;i<n;i++){ for(int j=0;j<n;j++) cout<<(a[i][j]?'L':'S'); cout<<endl;}
}


#include<iostream>
using namespace std;
bool a[100][100];
main()
{
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++) for(int j=0;j<n;j++) a[i][j]=(i+j)%2?0:1;
	if(k>(n*n)/2+n%2) cout<<"NO";
	else for(int i=0,cnt=(n*n)/2+n%2-k;i<n;i++) for(int j=0;j<n;j++) if(cnt>0&&(i+j)%2==0) a[i][j]=0;
	for(int i=0;i<n;i++){ for(int j=0;j<n;j++) cout<<(a[i][j]?'L':'S'); cout<<endl;}
}


#include<iostream>
using namespace std;
bool a[100][100];
int main()
{
	int n, k;
	cin >> n >> k;

	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			if ((i + j) % 2 == 0 && k-->0)
				a[i][j] = 1;
	if (!k)
		cout << "NO";
	else
	{
		cout << "YES" << endl;
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
				cout << (a[i][j] ? "L" : "S");
			cout << endl;
		}
	}
}


#include<iostream>
using namespace std;
bool a[100][100];
int main()
{
	int n, k;
	cin >> n >> k;

	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			if ((i + j) % 2 == 0 && k-->0)
				a[i][j] = 1;
	if (k>-1)
		cout << "NO";
	else
	{
		cout << "YES" << endl;
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
				cout << (a[i][j] ? "L" : "S");
			cout << endl;
		}
	}
}


#include<iostream>
using namespace std;
bool a[100][100];
main()
{
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++) for(int j=0;j<n;j++) a[i][j]=(i+j)%2?0:1;
	if(k>(n*n)/2+n%2) cout<<"NO";
	else{cout<<"YES\n"; for(int i=0,cnt=(n*n)/2+n%2-k;i<n;i++) for(int j=0;j<n;j++) if((i+j)%2==0&&cnt-->0) a[i][j]=0;}
	for(int i=0;i<n;i++){ for(int j=0;j<n;j++) cout<<(a[i][j]?'L':'S'); cout<<endl;}
}


#include<iostream>
using namespace std;
bool a[100][100];
main()
{
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++) for(int j=0;j<n;j++) a[i][j]=(i+j)%2?0:1;
	if(k>(n*n)/2+n%2) cout<<"NO";
	else for(int i=0,cnt=(n*n)/2+n%2-k;i<n;i++) for(int j=0;j<n;j++) if((i+j)%2==0&&cnt-->0) a[i][j]=0;
	for(int i=0;i<n;i++){ for(int j=0;j<n;j++) cout<<(a[i][j]?'L':'S'); cout<<endl;}
}


#include<iostream>
using namespace std;
bool a[100][100];
main()
{
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++) for(int j=0;j<n;j++) a[i][j]=(i+j)%2?0:1;
	if(k>(n*n)/2+n%2) cout<<"NO";
	else for(int i=0,cnt=11;i<n;i++) for(int j=0;j<n;j++) if(cnt-->0&&(i+j)%2==0) a[i][j]=0;
	for(int i=0;i<n;i++){ for(int j=0;j<n;j++) cout<<(a[i][j]?'L':'S'); cout<<endl;}
}


#include<iostream>
using namespace std;
bool a[100][100];
int main()
{
	int n, k;
	cin >> n >> k;

	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			if ((i + j) % 2 == 0 && k-->0)
				a[i][j] = 1;
	if (k+1)
		cout << "NO";
	else
	{
		cout << "YES" << endl;
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
				cout << (a[i][j] ? "L" : "S");
			cout << endl;
		}
	}
}


#include <iostream>
#include <string.h>
#include <string>
#include <fstream>
#include <vector>
#include <iomanip>
#include <queue>
#include <set>
#include <stack>
#include <math.h>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <cassert>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <double, double> pdd;

const double eps=1E-9;
const double Exp=2.718281828459045;
const double Pi=3.1415926535897932;

#define f first
#define s second
#define linf 2000000000000000000LL
#define FILL(a,b) memset(a, b, sizeof(a))
#define pb push_back
#define mp make_pair
#define sc(mas) scanf("%d",&mas)
#define scll(mas) scanf("%I64d",&mas)
#define sc2(f1,f2) scanf("%d%d",&f1,&f2)
#define sc3(f1,f2,f3) scanf("%d%d%d",&f1,&f2,&f3)
#define fore(op,po) for (int op=0;op<po;++op)
#define fori(p) for (int i=0;i<p;++i)
#define forj(p) for (int j=0;j<p;++j)
#define rep(a,b) for (int i=a;i<=b;++i)
#define srep(i,f) for (int i=1;i<=n;++i)
#define bit(mask,i) ((mask>>i)&1)
#define pri(ff) printf("%d\n",ff)
#define pr2(f1,f2) printf("%d %d\n",f1,f2)
#define prll(fl) printf("%I64d\n",fl)
#define prid(f1) printf("%.15lf\n",f1);
#define prn printf("NO\n")
#define pry printf("YES\n")

const int Max_Bit=63;
const int INF=2000000000;
const ll LINF=1000000000000000007ll;
const int MOD=1000000007;
const int NMAX=100005;
const int MMAX=105;
const int KMAX=6;
const string CODE="CODEFORCES";

int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
    int n,k,o=0;
    char c[MMAX][MMAX];
    sc2(n,k);
    fori(n) {c[0][i+1]='S'; c[i+1][0]='S';}
    fori(n) {
        forj(n) {
           if ((o==k) or (c[i][j+1]=='L') or (c[i+1][j]=='L')) {c[i+1][j+1]='S';}
           else {c[i+1][j+1]='L'; o++;}
        }
    }
    if (o==k) {
        pry;
        fori(n) {
            forj(n) {cout << c[i+1][j+1];}
            cout << endl;
        }
    }
    else {prn;}
    return 0;
}


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

#define MN 10000
#define MOD 10000
#define mp( a ,  b ) make_pair( ( a ), ( b ) )
#define pb( a ) push_back( a )
#define All( a ) a.begin(), a.end()
#define fi first
#define se second

int check(int a[][101], int x, int y)
{
    if(!a[x-1][y]&&!a[x+1][y]&&!a[x][y-1]&&!a[x][y+1])
        return 1;
    return 0;
}
int main()
{
    int n, m;
    cin >> n >> m;
    int a[101][101];
    memset(a, 0, sizeof(a));
    int cnt = 0;
    for (int i = 1; i <= n; i ++)
    {
        for (int j = 1; j <= n; j ++)
        {
            if(check(a,i,j))
            {
                a[i][j] = 1;
                cnt++;
            }
            if (cnt == m) break;
        }
        if (cnt == m) break;
    }
    if (cnt == m)
      {
          cout << "YES" << endl;
          for (int i = 1; i <= n; i ++)
            {
                for (int j = 1; j <= n; j ++)
                    printf("%c", a[i][j] == 0 ? 'S' : 'L');
                cout << endl;
            }
      }
      else cout << "NO" << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MN 10000
#define MOD 10000
#define mp( a ,  b ) make_pair( ( a ), ( b ) )
#define pb( a ) push_back( a )
#define All( a ) a.begin(), a.end()
#define fi first
#define se second
int check(int a[][101], int x, int y)
{
    if(!a[x-1][y]&&!a[x+1][y]&&!a[x][y-1]&&!a[x][y+1])
        return 1;
    return 0;
}
int main()
{
    int n, m;
    cin >> n >> m;
    int a[101][101];
    memset(a, 0, sizeof(a));
    int cnt = 0;
    for (int i = 1; i <= n; i ++)
    {
        for (int j = 1; j <= n; j ++)
        {
            if(check(a,i,j))
            {
                a[i][j] = 1;
                cnt++;
            }
            if (cnt == m) break;
        }
        if (cnt == m) break;
    }
    if (cnt == m)
      {
  for (int i = 1; i <= n; i ++)
    {
        for (int j = 1; j <= n; j ++)
            printf("%c", a[i][j] == 1 ? 'L' : 'S');
        cout << endl;
    }
      }
      else cout << "NO" << endl;
    return 0;
}